亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

ajax后臺處理返回json值示例代碼

 更新時(shí)間:2013年09月05日 17:38:28   作者:  
很多的新手朋友們不知道ajax如何處理返回json值,在本文將為大家詳細(xì)介紹下
復(fù)制代碼 代碼如下:

public ActionForward xsearch(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String parentId = request.getParameter("parentId");
String supplier = request.getParameter("supplier");
List itemList = new ArrayList();
if(parentId.equals("")){
parentId="0";
}
Map map=new TawApTreeServlet().getTypeList(parentId, supplier);

for (Iterator rowIt = map.keySet().iterator(); rowIt.hasNext();) {
String id = (String) rowIt.next();
TawCommonsUIListItem uiitem = new TawCommonsUIListItem();
uiitem.setItemId(id);
uiitem.setText((String)map.get(id));
uiitem.setValue(id);
itemList.add(uiitem);
}

response.setContentType("text/xml;charset=UTF-8");

// 返回JSON對象
response.getWriter().print(JSONUtil.list2JSON(itemList));
return null;
}

相關(guān)文章

最新評論