网站地图    收藏   

主页 > 前端 > css教程 >

ajax后台处理返回json值 - html/css语言栏目:html.c

来源:自学PHP网    时间:2015-04-14 14:51 作者: 阅读:

[导读] blic ActionForward xsearch(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ......

blic 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;  
}  

 

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论