Home > Web Front-end > JS Tutorial > jquery easyui combined with jsp to simply display table data example_jquery

jquery easyui combined with jsp to simply display table data example_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 16:51:58
Original
2273 people have browsed it
复制代码 代码如下:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>




Insert title here







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








First Name Last Name Phone Email





复制代码 代码如下:

<%@page import="net.sf.json.JSONArray"%>
<%@page import="java.util.*"%>
<%@page import="org.codehaus.jackson.map.ObjectMapper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
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 combined with jsp to simply display table data example_jquery
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template