net.sf.json出现的问题,实在解决不了啊
信息: Property 'jianjie' of class com.object.Sz has no read method. SKIPPED
四月 25, 2019 7:05:17 下午 net.sf.json.JSONObject defaultBeanProcessing
信息: Property 'mode' of class com.object.Sz has no read method. SKIPPED
四月 25, 2019 7:05:17 下午 net.sf.json.JSONObject defaultBeanProcessing
信息: Property 'official' of class com.object.Sz has no read method. SKIPPED
四月 25, 2019 7:05:17 下午 net.sf.json.JSONObject defaultBeanProcessing
信息: Property 'postcode' of class com.object.Sz has no read method. SKIPPED
四月 25, 2019 7:05:17 下午 net.sf.json.JSONObject defaultBeanProcessing
信息: Property 'productname' of class com.object.Sz has no read method. SKIPPED
我的大概代码
List<Sz> array = new ArrayList<Sz>();
JSONArray jsonArray = new JSONArray();
String v1 = request.getParameter("value1");
try {
Connection newcon = conn.getcon();
Statement state = newcon.createStatement();
String sql = "select * from product,(select d.id from (select *from kind where p_id=(select id from kind where kindname='"+v1+"'))as c,kind d where c.id=d.p_id)as e where e.id=product.thing_pid";
ResultSet rs = state.executeQuery(sql);
while(rs.next())
{
Sz s1 = new Sz(rs.getString("productname"), rs.getString("use"), rs.getString("factory"), rs.getString("official"), rs.getInt("postcode"),rs.getInt("telphone"), rs.getString("jianjie"), rs.getString("mode"));
//System.out.println(name + "\t" + id);
array.add(s1);
JSONObject object = JSONObject.fromObject(s1);
jsonArray.add(object);
}
rs.close();
newcon.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//jsonArray = JSONArray.fromObject(array);
System.out.println(jsonArray);
package com.object;
public class Sz {
public String productname;
public String mode;
public String use;
public Integer telphone;
public String jianjie;
public String factory;
public String official;
public Integer postcode;
public Sz(String productname,String use,String factory,String official,Integer postcode,Integer telphone,String jianjie,String mode){
this.productname = productname;
this.use = use;
this.factory = factory;
this.official = official;
this.postcode = postcode;
this.telphone = telphone;
this.jianjie = jianjie;
this.mode = mode;
}