当前位置:编程学习 > JAVA >>

javaWeb 开发中 使用ssh+ajax+json 开发时,json数据转换问题

现有一个java类

package mode;

import java.util.HashSet;
import java.util.Set;

/**
 * Products entity. @author MyEclipse Persistence Tools
 */

public class Products implements java.io.Serializable {

// Fields

/**
 * 
 */
private static final long serialVersionUID = 1L;
private Integer prId;
private String prImg;
private String prName;
private String prNumber;
private Integer prType;
private String prSummary;
private String prSummaryImg;
private String prSummary1;
private String prSummary2;
private String prSummary3;
private String prSummary4;
private String prFeaturesImg1;
private String prFeaturesImg2;
private String prSpsImg;
private String prSpsSystem;
private String prSps3g;
private String prSpsGsm;
private String prSpsShape;
private String prSpsHwd;
private String prSpsWeight;
private String prSpsCapacity;
private String prSpsScreen;
private String prSpsResolution;
private String prSpsSize;
private String prSpsVquality;
private String prSpsPlayformats;
private String prSpsVrecording;
private String prSpsMusicPlayer;
private String prSpsBluetooth;
private String prSpsUsb;
private String prSpsWifi;
private String prSpsAgps;
private String prReview;

 private Set<?> showimgs = new HashSet(0);
 private Set<?> reviews = new HashSet(0);

// Constructors

/** default constructor */
public Products() {
}

/** full constructor */
public Products(String prImg,String prName, String prNumber, Integer prType,
String prSummary, String prSummaryImg, String prSummary1,
String prSummary2, String prSummary3, String prSummary4,
String prFeaturesImg1, String prFeaturesImg2, String prSpsImg,
String prSpsSystem, String prSps3g, String prSpsGsm,
String prSpsShape, String prSpsHwd, String prSpsWeight,
String prSpsCapacity, String prSpsScreen, String prSpsResolution,
String prSpsSize, String prSpsVquality, String prSpsPlayformats,
String prSpsVrecording, String prSpsMusicPlayer,
String prSpsBluetooth, String prSpsUsb, String prSpsWifi,
String prSpsAgps, String prReview, Set showimgs, Set reviews) {
this.prImg=prImg;
this.prName = prName;
this.prNumber = prNumber;
this.prType = prType;
this.prSummary = prSummary;
this.prSummaryImg = prSummaryImg;
this.prSummary1 = prSummary1;
this.prSummary2 = prSummary2;
this.prSummary3 = prSummary3;
this.prSummary4 = prSummary4;
this.prFeaturesImg1 = prFeaturesImg1;
this.prFeaturesImg2 = prFeaturesImg2;
this.prSpsImg = prSpsImg;
this.prSpsSystem = prSpsSystem;
this.prSps3g = prSps3g;
this.prSpsGsm = prSpsGsm;
this.prSpsShape = prSpsShape;
this.prSpsHwd = prSpsHwd;
this.prSpsWeight = prSpsWeight;
this.prSpsCapacity = prSpsCapacity;
this.prSpsScreen = prSpsScreen;
this.prSpsResolution = prSpsResolution;
this.prSpsSize = prSpsSize;
this.prSpsVquality = prSpsVquality;
this.prSpsPlayformats = prSpsPlayformats;
this.prSpsVrecording = prSpsVrecording;
this.prSpsMusicPlayer = prSpsMusicPlayer;
this.prSpsBluetooth = prSpsBluetooth;
this.prSpsUsb = prSpsUsb;
this.prSpsWifi = prSpsWifi;
this.prSpsAgps = prSpsAgps;
this.prReview = prReview;
 this.showimgs = showimgs;
 this.reviews = reviews;
}

// Property accessors

// get set
.....

}

将Action中 private ArrayList<Products> prList; 将这个集合转换成json时代码始终过去不。。
在使用JSONArray jsonArray=JSONArray.fromObject(prList); 转换成json 对象时无法通过 
控制台无异常
后续代码将不会执行。。
但是只要将HashSet类型的属性去掉,代码就运行正常、、
JSON Ajax SSH Java Web --------------------编程问答--------------------   修改成
  private HashSet set = new HashSet();
  private HashSet set = new HashSet();
 试一试!
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,