aa.jsp
=======================
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="scripts/css/jquery-ui-
1.10.3.custom.css" />
<link rel="stylesheet" href="scripts/css/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" href="scripts/css/ui.multiselect.css" />
<script src="http://code.jquery.com/jquery-1.7.js">
</script>
<script src="scripts/js/i18n/grid.locale-en.js">
</script>
<script src="scripts/js/jquery.jqGrid.min.js">
</script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#grid').jqGrid({
url:'bb.jsp',
datatype:'json',
jsonReader:{page:'page',root:'list',total:'total'},
colNames:['id','pw','ADDR','TEL'],
colModel:[
{name:'id',width:50, editable:false},
{name:'pw',width:50, editable:true},
{name:'addr',width:50, editable:true},
{name:'tel',width:50, editable:true}
],
width:500,
viewrecords:true,
rowNum:3,
rowList:[3,6,9],
caption:'회원리스트',
pager:'#pager',
editurl:"cc.jsp"
});
$("#grid").navGrid("#pager",
{add:true,del:true,edit:true,search:true,refresh:true});
});
</script>
</head>
<body>
<table id="grid"></table>
<div id="pager"></div>
</body>
</html>
bb.jsp
==================
<%@page import="kr.co.seoulit.member.to.MemberBean"%>
<%@page import="kr.co.seoulit.common.to.ListForm"%>
<%@page import="kr.co.seoulit.member.dao.MemberDAOImpl"%>
<%@page import="java.lang.reflect.Member"%>
<%@page import="kr.co.seoulit.member.dao.MemberDAO"%>
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ page import="java.util.*" %>
<%@ page import="net.sf.json.*"%>
<%
int pagenum=Integer.parseInt(request.getParameter("page"));
int rowsize=Integer.parseInt(request.getParameter("rows"));
MemberDAOImpl dao=(MemberDAOImpl)MemberDAOImpl.getInstance();
int dbcount=dao.selectRowCount();
ListForm listForm=new ListForm();
listForm.setRowsize(rowsize);
listForm.setPagenum(pagenum);
listForm.setDbcount(dbcount);
int sr=listForm.getStartrow();
int er=listForm.getEndrow();
List<MemberBean> list=dao.selectMemberList(sr,er);
HashMap<String,Object> map=new HashMap<String,Object>();
int pagecount=listForm.getPagecount();
map.put("page",pagenum);
map.put("total",pagecount);
map.put("list",list);
JSONObject jsonObject=JSONObject.fromObject(map);
/* Enumeration<String> arr=request.getParameterNames();
while(arr.hasMoreElements()){
String n=arr.nextElement();
String v=request.getParameter(n);
System.out.println("이름:"+n);
System.out.println("값:"+v);
} */
out.println(jsonObject);
%>
cc.jsp
======================
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ page import="java.util.*" %>
<%
Enumeration<String> e=request.getParameterNames();
while(e.hasMoreElements()){
String name=e.nextElement();
String value=request.getParameter(name);
System.out.println(name+","+value);
}
%>
'개발하자 > jgGrid' 카테고리의 다른 글
jqGrid 이용하여 db테이블 불러와서 선택정보를 ajax로 json이용하여 나타내기 (0) | 2015.03.17 |
---|---|
선택누르면 jqgrid에서 id값 alert에 띄우기 (0) | 2015.03.17 |
페이지카운트 (0) | 2015.03.17 |
rowList:[3,6,9] (0) | 2015.03.17 |
그리드에 페이지달기 (0) | 2015.03.17 |