HttpServletResponse response = ServletActionContext.getResponse();
JSONArray jsonArray = new JSONArray();
for (AppAddress address:appAddressList)
{
JSONObject json = new JSONObject();
json.put("id",address.getId());
json.put("name",address.getName());
json.put("type",address.getType());
json.put("parent_id",address.getType());
jsonArray.put(json);
}
System.out.println(jsonArray.toString());
response.setCharacterEncoding("UTF-8");
public class AppAddress
{
private static final long serialVersionUID = -4789528924681418782L;
private Long id;
private String name;
private Long type;
private Long parent_id;
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public Long getType()
{
return type;
}
public void setType(Long type)
{
this.type = type;
}
public Long getParent_id()
{
return parent_id;
}
public void setParent_id(Long parent_id)
{
this.parent_id = parent_id;
}
}