一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

jQuery实现标签子元素的添加和赋值方法

时间:2018-02-27 编辑:猪哥 来源:一聚教程网

一、在jsp页面中定义

二、编写js语句:


三、编写对应的请求语句:

List deptList=null;
@RequestMapping(value = "/getDepts",method = {RequestMethod.GET})
public void getDepts(HttpServletResponse response) throws IOException {
response.setCharacterEncoding("utf-8");
response.setContentType("text/json;charset=utf-8");
if (deptList == null){
deptList = deptService.findAllDepts();
}else {
String res=JSON.toJSONString(deptList);
response.getWriter().write(res);
}
}

四、实现效果如下: