상세 컨텐츠

본문 제목

JQGrid 이용해서 테이블 수정 삭제 추가 해보기

관리X 과거글

by 까먹기전에 2015. 3. 17. 21:30

본문

반응형







=====================페이지===========================

<%@page import="kr.co.seoulit.member.to.MemberBean"%>

<%@ page language="java" contentType="text/html; charset=EUC-KR"

    pageEncoding="EUC-KR"%>

<%@ page import="java.util.*" %>

<%@ page import="kr.co.seoulit.member.dao.*" %>

<%@ page import="kr.co.seoulit.common.to.*" %>

<%@ page import="net.sf.json.*"%>  


<%

 int pagenum=Integer.parseInt(request.getParameter("page"));

 int rowsize=Integer.parseInt(request.getParameter("rows"));

 MemberDAOImpl dao=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);

 out.println(jsonObject);

%>


 <%

 Enumeration<String> list2 = request.getParameterNames();

 while(list2.hasMoreElements()){

String n=list2.nextElement();

 System.out.println("키"+n+"값:"+request.getParameter(n)); 

 }

 %>

================크루트 부분=====================

<%@ page language="java" contentType="text/html; charset=EUC-KR"

pageEncoding="EUC-KR"%>

<%@ page import="java.util.*" %> 

<%@ page import="kr.co.seoulit.member.dao.*" %>

<%@ page import="kr.co.seoulit.member.to.*" %>


<%

MemberDAOImpl dao = MemberDAOImpl.getInstance();

MemberBean mem;

String sel=request.getParameter("oper");

int rst=0;



switch(sel){


case "add" :

mem=new MemberBean();

mem.setId(request.getParameter("id"));

mem.setPw(request.getParameter("pw"));

mem.setAddr(request.getParameter("addr"));

mem.setTel(request.getParameter("tel"));

rst=dao.inserMember(mem);

break;

case "del" :

rst=dao.deleteMember(request.getParameter("id"));

break;

case "edit" :

mem=new MemberBean();

mem.setId(request.getParameter("id"));

mem.setPw(request.getParameter("pw"));

mem.setAddr(request.getParameter("addr"));

mem.setTel(request.getParameter("tel"));

//rst=dao.updateMember(mem);

}



%>

============================1명 상세정보 보기===============
<%@page import="java.net.URLDecoder"%>
<%@page import="java.util.HashMap"%>
<%@page import="kr.co.seoulit.member.to.MemberBean"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="kr.co.seoulit.member.dao.*" %>
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>

<%

String id=URLDecoder.decode(request.getParameter("idd"),"UTF-8");
MemberDAOImpl dao = MemberDAOImpl.getInstance();
MemberBean mem = dao.selectMember(id);
System.out.println("내가 선택한넘"+id);
HashMap<String,MemberBean> map = new HashMap<String,MemberBean>();
map.put("list", mem);
JSONObject jo = JSONObject.fromObject(map);
System.out.println(jo);
out.print(jo);
%>


관련글 더보기