欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

jquery easyui 结合jsp简单展现table数据示例_jquery

程序员文章站 2022-03-27 20:57:36
...
复制代码 代码如下:

pageEncoding="UTF-8"%>




Insert title here







url="getUsers.jsp"
toolbar="#toolbar" rownumbers="true"
fitColumns="true" singleSelect="true">








First Name Last Name Phone Email





复制代码 代码如下:




pageEncoding="UTF-8"%>




Insert title here


//String json = "{\"firstname\":\"firstname\",\"lastname\":\"lastname\",\"phone\":123456,\"email\":\"281446883@qq.com\"}";
List> list = new ArrayList>();
Map user1 = new HashMap();
user1.put("firstname", "name1");
user1.put("lastname", "name2");
user1.put("phone", "1234");
user1.put("email", "281446888@qq.com");
list.add(user1);

Map user2 = new HashMap();
user2.put("firstname", "name2");
user2.put("lastname", "name4");
user2.put("phone", "1234");
user2.put("email", "281446888@qq.com");
list.add(user2);

JSONArray jsonArray = JSONArray.fromObject(list);
System.out.println(jsonArray.toString());
Map map = new HashMap();
map.put("total", 1);
map.put("rows", jsonArray);

ObjectMapper objMap = new ObjectMapper();
objMap.writeValue(response.getWriter(), map);
//System.out.println(json);
%>



效果:
jquery easyui 结合jsp简单展现table数据示例_jquery