jquery Easyui combined with JSP simple presentation table Data sample _jquery

Source: Internet
Author: User
Copy Code code as follows:

<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "
pageencoding= "UTF-8"%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>insert title here</title>
<link rel= "stylesheet" type= "Text/css" href= "Easyui/themes/default/easyui.css" >
<link rel= "stylesheet" type= "Text/css" href= "Easyui/themes/icon.css" >
<script type= "Text/javascript" src= "Easyui/jquery-1.8.0.min.js" ></script>
<script type= "Text/javascript" src= "Easyui/jquery.easyui.min.js" ></script>

<body>
<table id= "DG" title= "My Users" class= "Easyui-datagrid" style= "width:500px;height:250px"
Url= "Getusers.jsp"
Toolbar= "#toolbar" rownumbers= "true"
Fitcolumns= "true" singleselect= "true" >
<thead>
<tr>
<th field= "FirstName" width= ">first name</th>"
<th field= "LastName" width= ">last name</th>"
<th field= "Phone" width= "M" >Phone</th>
<th field= "Email" width= ">Email</th>"
</tr>
</thead>
</table>

</body>

Copy Code code as follows:

<% @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"%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>insert title here</title>
<body>
<%
String json = "{\ firstname\": \ "firstname\", \ "lastname\": \ "lastname\", \ "phone\": 123456,\ "email\": \ "281446883@ Qq.com\ "}";
list<map<string,string>> list = new arraylist<map<string,string>> ();
Map<string,string> user1 = new hashmap<string,string> ();
User1.put ("FirstName", "name1");
User1.put ("LastName", "name2");
User1.put ("Phone", "1234");
User1.put ("email", "281446888@qq.com");
List.add (user1);

map<string,string> user2 = new hashmap<string,string> ();
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<string,object> map = new hashmap<string,object> ();
Map.put ("Total", 1);
Map.put ("Rows", Jsonarray);

Objectmapper objmap = new Objectmapper ();
Objmap.writevalue (Response.getwriter (), map);
SYSTEM.OUT.PRINTLN (JSON);
%>
</body>

Effect:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.