<div class="codetitle"> <span><a style="CURSOR: pointer" data="95048" class="copybut" id="copybut95048" onclick="doCopy('code95048')"><u>复代码</u></a></span> 代码如下:</div> <div class="codebody" id="code95048"> <br><%@ 페이지 언어="java" contentType="text/ html; charset=UTF-8" <BR>pageEncoding="UTF-8"%> <br><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <br><html> <br><머리> <br><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <br><title>여기에 제목을 삽입하세요</title> <br><link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css"> <br><link rel="stylesheet" type="text/css" href="easyui/themes/icon.css"> <br><script type="text/javascript" src="easyui/jquery-1.8.0.min.js"></script> <br><script type="text/javascript" src="easyui/jquery.easyui.min.js"></script> <br><br></head> <br><본문> <br><table id="dg" title="My Users" class="easyui-datagrid" style="width:500px;height:250px" <BR>url="getUsers.jsp" <BR>toolbar= "#toolbar" rownumbers="true" <BR>fitColumns="true" SingleSelect="true"> <br><머리> <br><tr> <br><th field="firstname" width="50">이름</th> <br><th field="lastname" width="50">성</th> <br><th field="phone" width="50">전화</th> <br>이메일 <br></tr> <br></머리> <br></테이블> <br><br></body> <br></html> <br> </div> <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="86762" class="copybut" id="copybut86762" onclick="doCopy('code86762')"><u>复代码</u></a></span> 代码如下:</div> <div class="codebody" id="code86762"> <br><%@page import ="net.sf.json.JSONArray"%> <br><%@page import="java.util.*"%> <br><%@page import="org.codehaus.jackson.map.ObjectMapper"%> <br><%@ 페이지 언어="java" contentType="text/html; charset=UTF-8" <BR>pageEncoding="UTF-8"%> <br><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <br><html> <br><머리> <br><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <br><title>여기에 제목을 삽입하세요</title> <br></head> <br><본문> <br><% <BR>//String json = "{"firstname":"firstname","lastname":"lastname","phone":123456,"email":"281446883@qq.com"} "; <BR>목록<맵<문자열,문자열>> list = new ArrayList<Map<String,String>>(); <br>지도<string> user1 = 새로운 HashMap<String,String>(); <br>user1.put("이름", "이름1"); <br>user1.put("성", "이름2"); <br>user1.put("전화", "1234"); <br>user1.put("이메일", "281446888@qq.com"); <br>list.add(user1); <br><br>맵<string> user2 = 새로운 HashMap<String,String>(); <br>user2.put("이름", "이름2"); <br>user2.put("성", "이름4"); <br>user2.put("전화", "1234"); <br>user2.put("이메일", "281446888@qq.com"); <br>list.add(user2); <br><br>JSONArray jsonArray = JSONArray.fromObject(list); <br>System.out.println(jsonArray.toString()); <br>지도 map = new HashMap<String,Object>(); <br>map.put("전체", 1); <br>map.put("rows", jsonArray); <br><br>ObjectMapper objMap = new ObjectMapper(); <br>objMap.writeValue(response.getWriter(), map); <br>//System.out.println(json); <br>%> <br></body> <br></html> <br></string></string> </div> <br>效果: <br><img src="http://files.jb51.net/file_images/article/201404/201404181501537.gif?20143181526" alt="jquery easyui를 jsp와 결합하여 테이블 데이터를 간단히 표시함 example_jquery" >