1,javascript 页面中的函数 
 
页面代码: 
 
服务器端
 
public String querySubChannelArticle(){  
HttpServletResponse response=getResponse(); 
HttpServletRequest request=getRequest(); 
 response.setContentType("application/json; charset=UTF-8"); 
 PrintWriter out =null; 
 try { 
     out = response.getWriter();
     List<Map<String,Object>> list = new LinkedList<Map<String,Object>>(); 
     if(channelId!=null && !channelId.equals("")){ 
  Channel tmp = new Channel(); 
  tmp.setChannelId(Integer.parseInt(channelId)); 
  subChannelList = subChannelDAO.listSubChannel(tmp);
  for(Object oo:subChannelList){ 
  Map<String,Object> obj = new HashMap<String,Object>(); 
  SubChannel c = (SubChannel)oo; 
  obj.put("subId", c.getSubId()); 
  obj.put("subName", c.getSubName()); 
  list.add(obj); 
  } 
     } 
     String outStr = JsonUtil.toJSONStr(list); 
     out.println(outStr); 
 }catch(Exception e){ 
 e.printStackTrace(); 
 } 
 out.flush(); 
 out.close(); 
 return null; 
}