ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [ERMaster] shoppingmall - admin
    WEB/ERMaster 2022. 9. 10. 12:57

     

    footer.jsp에 내용 추가
    admin 생성
     
     
    관리자 로그인 폼
    else if(command.equals("admin")) ac=new AdminAction(); 
    package com.sam.shop.controller.action.admin;
    
    import java.io.IOException;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import com.sam.shop.controller.action.Action;
    
    public class AdminAction implements Action {
    
    	@Override
    	public void execute(HttpServletRequest request, 
    			HttpServletResponse response) 
    			throws ServletException, IOException {
    
    		String url="admin/adminLogin.jsp";
    		request.getRequestDispatcher(url).forward(request, response);
    	}
    }
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <link rel="stylesheet" href="admin/css/admin.css">
    <script src="admin/script/admin.js"></script>
    </head>
    <body>
    <div id="wrap">
    <header>
    	<div id="logo">
    		<img src="admin/images/bar_01.gif" style="float:left;">
    		<img src="admin/images/text.gif"></div>
    </header>
    <div class="clear"></div>
    <article>
    	<div id="loginform">
    		<form name="frm" method="post" action="shop.do">
    			<input type="hidden" name="command" value="adminLogin">
    			<table>
    				<tr>
    					<td>아이디</td>
    					<td><input type="text" name="workid" size="10"></td></tr>
    				<tr>
    					<td>비밀번호</td>
    					<td><input type="password" name="workPwd" size="10"></td></tr>
    				<tr align="center">
    					<td colspan="2">
    						<input class="btn" type="submit" value="로그인"
    							onClick="return workerCheck();">
    						<br><br>
    						<h4 style="color:red">${message }</h4></td></tr>
    			</table>
    		</form>
    	</div>
    </article>
    </div>
    </body>
    </html>

     

    css 파일

    @charset "UTF-8";
    
    .clear{clear:both;}
    
    header{height:151px;}
    body{background-color:white; margin:0; padding:0; 
    			font-size:0.75em; line-height:1.2em; color:#333;}
    
    a{text-decoration:none; color:#333;}
    a:hover{text-decoration: underline; color:#F90; 
    			cursor:pointer;}
    
    #wrap{width:971px; text-align:center; margin:0px; 
    margin-right:auto; margin-left:auto; min-height:923px;}
    #login{width:200px; float:right; margin-top:10px}
    #login a{text-decoration:none; font-size:10px;}
    #login a:hover{color:orange;}
    
    .btn{width:100px; border-radius:5px; 
    	background-color: #FC3; color:#333; text-align:center;
    	text-decoration:none; box-shadow:3px 3px 3px #999999; 
    	padding:5px; margin:0 7px 7px 0px;}
    .btn:HOVER{background-color:#FFF;}
    .btn:ACTIVE{box-shadow:none;}
    
    article{min-height:600px;}
    #logo{width:971px; margin:60px 0 40px 0;}
    
    #loginform{margin-left:400px;}
    th{background-color:#E4E4E4;}
    th, td{padding:8px 5px;}
    
    table#productList{
    	border-collapse:collapse;/*border 사이 간격 없앰*/
    	border-top:2px solid #333; 
    	border-bottom:1px solid #333; 
    	width:80%;/*전체 테이블 길이 설정*/ 
    	margin-left:100px; margin-bottom:20px;}

     

    function workerCheck(	){
    	if(document.frm.workid.value==""){
    		alert("아이디를 입력하세요.");
    		return false;
    	}else if(document.frm.workPwd.value==""){
    		alert("비밀번호를 입력하세요");
    		return false;
    	}
    	return true;	
    }
     

     

    로그인 실행하기

    else if(command.equals("adminLogin")) ac=new AdminLoginAction(); 
    package com.sam.shop.controller.action.admin;
    
    import java.io.IOException;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import com.sam.shop.controller.action.Action;
    
    public class AdminLoginAction implements Action {
    
    	@Override
    	public void execute(HttpServletRequest request, 
    			HttpServletResponse response) 
    			throws ServletException, IOException {
    
    		String workId=request.getParameter("workId");
    		String workPwd=request.getParameter("workPwd");
    		
    		String url="shop.do?command=admin";
    		
    		AdminDao adao=AdminDao.getInstance();
    		AdminVO avo=adao.workerCheck(workId);
    		
    		if( avo==null) 
    			request.setAttribute("message", "아이디가 없습니다");
    		else if( avo.getPwd() == null) 
    			request.setAttribute("message", "시스템 오류");
    		else if( !avo.getPwd().equals(workPwd) ) 
    			request.setAttribute("message", "비밀번호가 틀립니다");
    		else if( avo.getPwd().equals(workPwd) ) {
    			HttpSession session = request.getSession();
    			session.setAttribute("loginUser", avo);
    			url = "shop.do?command=adminProductList";
    		}
    		request.getRequestDispatcher(url).forward(request,response);
    	}
    }

     

    Dto

    package com.sam.shop.dto;
    
    public class AdminVO {
    	private String id;
    	private String pwd;
    	private String name;
    	private String phone;
    	
    	public String getId() {
    		return id;
    	}
    	public void setId(String id) {
    		this.id = id;
    	}
    	public String getPwd() {
    		return pwd;
    	}
    	public void setPwd(String pwd) {
    		this.pwd = pwd;
    	}
    	public String getName() {
    		return name;
    	}
    	public void setName(String name) {
    		this.name = name;
    	}
    	public String getPhone() {
    		return phone;
    	}
    	public void setPhone(String phone) {
    		this.phone = phone;
    	}
    }

     

    Dao

    package com.sam.shop.dao;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    
    public class AdminDao {
    	private AdminDao() {}
    	private static AdminDao itc = new AdminDao();
    	public static AdminDao getInstance() { return itc; }
    	
    	Connection con=null;
    	PreparedStatement pstmt=null;
    	ResultSet rs=null;
    }

     

    AdminDao에 workerCheck 생성

    public AdminVO workerCheck(String workId) {
    	AdminVO avo=null;
    	String sql="select*from worker where id=?";
    	con=Dbman.getConnection();
    	try {
    		pstmt=con.prepareStatement(sql);
    		pstmt.setString(1, workId);
    		rs = pstmt.executeQuery();
    		if(rs.next()) {
    			avo= new AdminVO();
    			avo.setId(rs.getString("id"));
    			avo.setPwd(rs.getString("pwd"));
    			avo.setName(rs.getString("name"));
    			avo.setPhone(rs.getString("phone"));
    		}
    	} catch (SQLException e) {e.printStackTrace();
    	} finally {  Dbman.close(con, pstmt, rs);}
    	return avo;
    }
     

    관리자 페이지

     

    1. header.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <link rel="stylesheet" href="admin/css/admin.css">
    <script src="admin/script/admin.js"></script>
    </head>
    <body>
    
    <div id="wrap">
    	<header>
    		<div id="logo">
    			<img style="width:800px;" src="admin/images/bar_01.gif">
    			<img src="admin/images/text.gif">
    		</div>
    		<input class="btn" type="button" value="logout"
    			stype="float:right;" 
    			onClick="location.href='shop.do?command=adminLogout'">
    	</header>
    	<div class="clear"></div>
    
     

    2. footer.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
        
    <div class="clear"></div>
    <footer><hr>
    	<div id="copy">
    	All contents Copyright 2022 HJKang.co Inc. all rights
    	reserved<br>Content mail : abc@abc.com Tel : +82 02 1234 1234
    	Fax : +82 02 1233 1233</div>
    </footer>
    </div>
    </body>
    </html>
     

    3. sub_menu.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <meta charset="UTF-8">
    
    <nav id="sub_menu">
    <h1>Admin Setting</h1>
    	<ul>
    		<li><a href="shop.do?command=adminProductList">
    			상품리스트</a></li>
    		<li><a href="shop.do?command=adminOrderList">
    			주문리스트</a></li>
    		<li><a href="shop.do?command=adminMemberList">
    			회원리스트</a></li>
    		<li><a href="shop.do?command=adminQnaList">
    			Q&amp;A리스트</a></li>
    	</ul>
    </nav>
     
     

     

    상품리스트

    else if(command.equals("adminProductList")) ac=new AdminProductListAction(); 
    package com.sam.shop.controller.action.admin;
    
    import java.io.IOException;
    import java.util.ArrayList;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import com.sam.shop.controller.action.Action;
    import com.sam.shop.dao.AdminDao;
    import com.sam.shop.dto.AdminVO;
    import com.sam.shop.dto.ProductVO;
    
    public class AdminProductListAction implements Action {
    
    	@Override
    	public void execute(HttpServletRequest request, 
    			HttpServletResponse response) 
    			throws ServletException, IOException {
    		
    		String url="admin/product/productList.jsp";
    		HttpSession session =request.getSession();
    		AdminVO avo=(AdminVO)session.getAttribute("loginUser");
    		if(avo==null) {
    			url="shop.do?command=admin";
    		} else {
    			AdminDao adao=AdminDao.getInstance();
    			ArrayList<ProductVO> productList=adao.listProduct();
    			request.setAttribute("productList", productList);
    		}
    		request.getRequestDispatcher(url).forward(request, response);
    	}
    }

     

    AdminDao에 listProduct 생성

    public ArrayList<ProductVO> listProduct() {
    	ArrayList<ProductVO> list=new ArrayList<ProductVO>();
    	String sql="select * from product order by pseq desc";
    	con=Dbman.getConnection();
    	try {
    		pstmt=con.prepareStatement(sql);
    		rs=pstmt.executeQuery();
    		while(rs.next()) {
    			ProductVO pvo=new ProductVO();
    			pvo.setPseq(rs.getInt("pseq"));
    			pvo.setIndate(rs.getTimestamp("indate"));
    			pvo.setName(rs.getString("name"));
    			pvo.setPrice1(rs.getInt("price1"));
    			pvo.setPrice2(rs.getInt("price2"));
    			pvo.setPrice3(rs.getInt("price3"));
    			pvo.setImage(rs.getString("image"));
    			pvo.setUseyn(rs.getString("useyn"));
    			pvo.setBestyn(rs.getString("bestyn"));
    			list.add(pvo);
    		}
    	} catch (SQLException e) {e.printStackTrace();
    	} finally {Dbman.close(con, pstmt, rs);}
    	return list;
    }

     

    productList.jsp로 이동

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ include file="/admin/header.jsp" %>
    <%@ include file="/admin/sub_menu.jsp" %>
    
    <article>
    	<h1>상품 리스트</h1>
    	<form name="frm" method="post">
    		<table>
    			<tr>
    				<td width="642">상품명
    					<input type="text" name="key" value="${key }">
    					<input class="btn" type="button" name="btn_search"
    						value="검색" onClick="">
    					<input class="btn" type="button" name="btn_total"
    						value="전체보기" onClick="">
    					<input class="btn" type="button" name="btn_write"
    						value="상품등록" onClick="go_wrt();">
    				</td>
    			</tr>
    		</table>
    	</form>
    	<table id="productList">
    		<tr><th>번호</th><th>상품명</th><th>원가</th>
    				<th>등록일</th><th>사용유무</th></tr>
    		<c:forEach items="${productList }" var="productVO">
    			<tr>
    				<td height="23" align="center">${productVO.pseq}</td>
    				<td style="text-align:left; padding-left:50px;">
    					<a href="#" onClick="">${productVO.name }</a></td>
    				<td><fmt:formatNumber value="${productVO.price1}"/></td>
    				<td><fmt:formatNumber value="${productVO.price2}"/></td>
    				<td><fmt:formatDate value="${productVO.indate}"/></td>
    				<td><c:chosse>
    					<c:when test='${productVO.useyn=="n" }'>미사용</c:when>
    					<c:otherwise>사용</c:otherwise>
    						</c:chosse></td>
    			</tr>
    		</c:forEach>
    	</table><br/><br/>
    </article>
    
    <%@ include file="/admin/footer.jsp" %>

     

    css 추가

    nav#top_menu{float:right; width:600px; margin:50px 20px 0 0;}
    nav#top_menu ul{list-style:none};
    nav#top_menu ul li{float:left; margin: 0 5px;}
    nav#top_menu ul li a{display:block; text-decoration:none; 
    	color:#333; padding: 10px;}
    nav#top_menu ul li a:hover{
    	background-repeat:repeat-x; background-position:bottom;
    	border-bottom:2px solid gray;}
    nav#top_menu ul li a.logout{margin-left:238px;}
    nav#top_menu ul li a.logout1{margin-left:210px;}
    footer{background-image:url("../images/under_logo.png");
    	background-repeat:no-repeat; background-position:40px center;
    	float:left; min-height:145px; width:952px; margin-left:10px;
    	margin-bottom:-100px;}
    footer hr{width:950px; border:1px solid;}
    #main_img{margin-top:40px;}
    #main_img img{padding-left:5px;}
    #main_img h1{text-align:center; font-size:20pt; 
    	font-weight:bold; font-family:sans-serif;}
    #imgId{width:30px; height:40px;}
    #productList td{padding-right:40px; text-align:right;}
    #list td{padding:8px 5px; text-align:left;}
    #review h1{text-align:center;}
    table#orderList{border-collapse:collapse; 
    border-top:2px solid #333; border-bottom:1px solid #333;
    width:85%; margin-left:100px; margin-bottom:20px;}
    #register{margin-left:300px;}
    #register table{border:1px solid black; border-spacing:5px;}
    #register td{border:1px solid black; width:270px;}
    #inseertTheater{margin-left:350px;}
    #inseertTheater table{border:1px solid gray; border-spacing:5px;}
    #inseertTheater td{border:1px solid gray;}
    #insertMovie{margin-left:300px;}
    #insertMovie table{border:1px solid gray; border-spacing:5px;}
    #insertMovie td{border:1px solid gray;}
    #insertMovieTime table{border:1px solid gray; border-spacing:5px;}
    #insertMovieTime td{border:1px solid gray;}
    #mypageReserve table{
    	border:1px solid black; width:480px; height:180px;
    	margin-top:10px; background-image:url("../images/tic.png");
    	background-repeat:no-repeat; background-position:center;
    	margin-left:300px; color:#006700;}
    #mapageReserve .btn{margin-right:30px;}
    #mapageReserve b{margin-top:50px; margin-left:110px;
    font-size:20pt; font-weight:bold;}
    #mapageReserveView table{
    	border:1px solid gray; width:500px; height:150px;
    	margin-top:10px; margin-left:300px;}
    #mapageReviewList table{
    	border:1px solid balck; width:800px;
    	margin-top:10px; margin-left:150px;}
    #mapageReviewList td{
    	border-bottom:1px solid gray; width:800px; height:30px;
    	margin-top:10px; }
    #mapageReviewList th{
    	border-bottom:1px solid black; width:20px; height:30px;}
    
    #userView table{border:1px solid black; width:500px; 
    margin-top:10px; margin-left:300px;}
    #userView td{border:1px solid graay; width:20px; height:30px}
    #userView th{
    	border:1px solid black; width:20px; height:30px;}
    #userView h1{padding:5px;}
    #userView a{text-decoration:none; font-size:12pt; 
    margin-bottom:100px; margin-left:150px;}
    #uesrUpdate h1{padding:5px;}
    #uesrUpdate table{margin-left:430px;}
    
    nav#sub_menu{float:left; margin-right:10px;}
    nav#sub_menu ul li{list-style-type:none; margin-top:10px;}
    nav#sub_menu a{text-decoration:none; color:#666;
    border-bottom:1px dotted #999; display:block;
    width:100px; height:25px; padding:5px;}
    nav#sub_menu a:hover{border-bottom:1px solid black;}
    nav#sub_menu h1{padding:5px; border-bottom:double;}
    nav#sub_menu ul{margin-left:-20px;}
    div.reviewdiv{font-family:"맑은 고딕"; font-size:15px; }
    div.reviewdiv table tr.review2 td
    {border-bottom:dotted; border-collapse:collapse;
    border-bottom-width:1px; text-align:center; }
    div.reviewdiv table tr.review2:HOVER{
    	background-color:#FAFAD2; color:inherit;
    }
    div.reviewdiv table tr.review2 td.starpoint{text-align:left;}
    div.reviewdiv table tr.reviewtable{width:1000px;}
    
    #check table{border:1px solid gray; 
    border-spacing:5px; margin-left:300px;}
    #check td{border:1px solid gray; }
    #check h1{font-size:10pt; text-align:center;}
    로그인 후 화면

     

    페이지 수 표시

    AdminProductListAction 수정

    package com.sam.shop.controller.action.admin;
    
    import java.io.IOException;
    import java.util.ArrayList;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import com.sam.shop.controller.action.Action;
    import com.sam.shop.dao.AdminDao;
    import com.sam.shop.dto.AdminVO;
    import com.sam.shop.dto.ProductVO;
    import com.sam.shop.util.Paging;
    
    public class AdminProductListAction implements Action {
    
    	@Override
    	public void execute(HttpServletRequest request, 
    			HttpServletResponse response) 
    			throws ServletException, IOException {
    		
    		String url="admin/product/productList.jsp";
    		
    		HttpSession session =request.getSession();
    		AdminVO avo=(AdminVO)session.getAttribute("loginUser");
    		if(avo==null) {
    			url="shop.do?command=admin";
    		} else {
    			AdminDao adao=AdminDao.getInstance();
    			
    			Paging paging=new Paging();
    			paging.setDisplayPage(10);
    			paging.setDisplayRow(10);
    			
    			if(request.getParameter("page")!=null){
    				paging.setPage(Integer.parseInt(request.getParameter("page")));
    				session.setAttribute("page", Integer.parseInt(request.getParameter("page")));
    			} else if(session.getAttribute("page")!=null) {
    				paging.setPage((Integer)session.getAttribute("page"));
    			} else {
    				paging.setPage(1);
    				session.removeAttribute("page");
    			}
    			int count=adao.getAllCount("product");
    			
    			ArrayList<ProductVO> productList=adao.listProduct();
    			request.setAttribute("productList", productList);
    		}
    		request.getRequestDispatcher(url).forward(request, response);
    	}
    }

     

    AdminDao에 getAllCount 생성

    public int getAllCount(String tableName) {
    	int count=0;
    	String sql="select count(*) as cnt from "
    			+tableName;;
    	con=Dbman.getConnection();
    	try {
    		pstmt=con.prepareStatement(sql);
    		rs = pstmt.executeQuery();
    		if(rs.next()) count=rs.getInt("cnt");
    	} catch (SQLException e) {e.printStackTrace();
    	} finally {  Dbman.close(con, pstmt, rs);}
    	return count;
    }

     

    AdminnDao에 listProduct 수정

    public ArrayList<ProductVO> listProduct(Paging paging) {
    	ArrayList<ProductVO> list=new ArrayList<ProductVO>();
    	String sql="select*from("
    			+ "select*from("
    			+ "select rownum as rn, p.from"
    			+ "((select * from product order by pseq desc) p)"
    			+ ") where rn>=?"
    			+ ") where rn<=?";
    	con=Dbman.getConnection();
    	try {
    		pstmt=con.prepareStatement(sql);
    		pstmt.setInt(1, paging.getStartNum());
    		pstmt.setInt(2, paging.getEndNum());
    		rs=pstmt.executeQuery();
    		while(rs.next()) {
    			ProductVO pvo=new ProductVO();
    			pvo.setPseq(rs.getInt("pseq"));
    			pvo.setIndate(rs.getTimestamp("indate"));
    			pvo.setName(rs.getString("name"));
    			pvo.setPrice1(rs.getInt("price1"));
    			pvo.setPrice2(rs.getInt("price2"));
    			pvo.setPrice3(rs.getInt("price3"));
    			pvo.setImage(rs.getString("image"));
    			pvo.setUseyn(rs.getString("useyn"));
    			pvo.setBestyn(rs.getString("bestyn"));
    			list.add(pvo);
    		}
    	} catch (SQLException e) {e.printStackTrace();
    	} finally {Dbman.close(con, pstmt, rs);}
    	return list;
    }
     
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>paging.jsp</title>
    
    <style type="text/css">
    	body{text-align:center;}
    	#paging{font-size:110%;}
    </style>
    
    </head>
    <body>
    	
    	<div id="paging" style="font-size:110%; font-weight:bold">
    		<c:url var="action" value="${param.command }" />
    		<c:if test="${paging.prev}">
    			<a href="${action}&page=${paging.beginPage-1}">
    				◀</a>&nbsp;
    		</c:if>
    		<c:forEach begin="${paging.beginPage}" 
    			end="${paging.endPage}" var="index">
    			<c:choose>
    				<c:when test="${paging.page==index}">
    					<span style="color:red">${index}&nbsp;</span>
    				</c:when>
    				<c:otherwise>
    					<a href="${action}&page=${index}&key=${key}">
    						${index}</a>&nbsp;
    				</c:otherwise>
    			</c:choose>
    		</c:forEach>
    		<c:if test="${paging.next}">
    			<a href="${action}&page=${paging.endPage+1}">
    				▶</a>&nbsp;
    		</c:if>
    	</div>
    		
    </body>
    </html>
    productList.jsp에 표시된 부분 추가
     
    페이지 수 나옴

    Q&A 리스트

    else if(command.equals("adminQnaList")) ac=new AdminQnaListAction(); 
    package com.sam.shop.controller.action.admin;
    
    import java.io.IOException;
    import java.util.ArrayList;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import com.sam.shop.controller.action.Action;
    import com.sam.shop.dao.AdminDao;
    import com.sam.shop.dto.AdminVO;
    import com.sam.shop.dto.ProductVO;
    import com.sam.shop.util.Paging;
    
    public class AdminQnaListAction implements Action {
    
    	@Override
    	public void execute(HttpServletRequest request, 
    			HttpServletResponse response) 
    			throws ServletException, IOException {
    		
    		String url="admin/qna/qnaList.jsp";
    		
    		HttpSession session =request.getSession();
    		AdminVO avo=(AdminVO)session.getAttribute("loginUser");
    		if(avo==null) {
    			url="shop.do?command=admin";
    		} else {
    			AdminDao adao=AdminDao.getInstance();
    			
    			Paging paging=new Paging();
    			paging.setDisplayPage(10);
    			paging.setDisplayRow(10);
    			
    			if(request.getParameter("page")!=null){
    				paging.setPage(Integer.parseInt(request.getParameter("page")));
    				session.setAttribute("page", Integer.parseInt(request.getParameter("page")));
    			} else if(session.getAttribute("page")!=null) {
    				paging.setPage((Integer)session.getAttribute("page"));
    			} else {
    				paging.setPage(1);
    				session.removeAttribute("page");
    			}
    			int count=adao.getAllCount("qna");
    			paging.setTotalCount(count);
    			
    			ArrayList<QnaVO> qnaList=adao.listQna(paging);
    			request.setAttribute("qnaList", qnaList);
    			request.setAttribute("paging", paging);
    		}
    		request.getRequestDispatcher(url).forward(request, response);
    	}
    }

     

    AdminDao에 listQna 생성

    public ArrayList<QnaVO> listQna(Paging paging) {
    	ArrayList<QnaVO> list=new ArrayList<QnaVO>();
    	String sql="select*from("
    			+ "select*from("
    			+ "select rownum as rn, q.*from"
    			+ "((select * from qna order by qseq desc) q)"
    			+ ") where rn>=?"
    			+ ") where rn<=?";
    	con=Dbman.getConnection();
    	try {
    		pstmt=con.prepareStatement(sql);
    		pstmt.setInt(1, paging.getStartNum());
    		pstmt.setInt(2, paging.getEndNum());
    		rs=pstmt.executeQuery();
    		while(rs.next()) {
    			QnaVO qvo=new QnaVO();
    			qvo.setQseq(rs.getInt("qseq"));
    			qvo.setSubject(rs.getString("subject"));
    			qvo.setContent(rs.getString("content"));
    			qvo.setId(rs.getString("id"));
    			qvo.setIndate(rs.getTimestamp("indate"));
    			qvo.setReply(rs.getString("reply"));
    			qvo.setRep(rs.getString("rep"));
    			list.add(qvo);
    		}
    	} catch (SQLException e) {e.printStackTrace();
    	} finally {Dbman.close(con, pstmt, rs);}
    	return list;
    }

    상품 등록하기

     

    function go_wrt(){
    	document.frm.action="shop.do?command=adminProdcutWriteForm";
    	document.frm.submit();
    }

     

    상품 등록 폼

    else if( command.equals("adminProductWriteForm") ) ac 
                              = new AdminProductWriteFormAction();
    package com.sam.shop.controller.action.admin;
    
    import java.io.IOException;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import com.sam.shop.controller.action.Action;
    import com.sam.shop.dto.AdminVO;
    
    public class AdminProductWriteFormAction implements Action {
    
    	@Override
    	public void execute(HttpServletRequest request, 
    			HttpServletResponse response) 
    			throws ServletException, IOException {
    		
    		String url = "admin/product/productWrite.jsp"; 
    		HttpSession session=request.getSession();
    		AdminVO avo=(AdminVO)session.getAttribute("loginAdmin");
    		if(avo==null) {
    			url="shop.do?command=admin";
    		}else {
    			String [] kindList= {"Hells","Boots","Sandals",
    										"Shcakers","Slipers","On Sale"};
    			// kind 값 입력 시 화면에 표시될 
                // 카테고리 이름들을 문자열에 넣고 
                // request에 담아서 이동함
    			request.setAttribute("kindList", kindList);
    		}
    	    request.getRequestDispatcher(url).forward(request, response);
    	}
    }
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ include file="/admin/header.jsp"%>
    <%@ include file="/admin/sub_menu.jsp"%>
    
    <article>
    <form name="frm" method="post" enctype="multipart/form-data">
    	<table id="list">
    		<tr><th>상품분류</th><td colspan="5">
    			<select name="kind">
    				<option value="">선택</option>
    				<c:forEach items="${kindList }" var="kind" 
    					varStatus="status">
    				<option value="${status.count }">${kind }</option>
    				</c:forEach>
    			</select></td></tr>
    		<tr><th>상품명</th><td width="343" colspan="5">
    			<input type="text" name="name" size="47" 
                        maxlength="100"></td></tr>
    		<tr>
    			<th>원가[A]</th><td width="70">
    				<input type="text" name="price1" size="11"
    					onkeyup="cal();"></td>
    			<th>판매가[B]</th><td width="70">
    				<input type="text" name="price2" size="11"
    					onkeyup="cal();"></td>
    			<th>[B-A]</th><td width="72">
    				<input type="text" name="price3" size="11"></td></tr>
    		<tr><th>상세설명</th><td colspan="5">
    			<textarea name="content" rows="8" cols="70">
    			</textarea></td></tr>
    		<tr><th>상품이미지</th><td width="343" colspan="5">
    			<input type="file" name="image"></td></tr>
    	</table>
    	<input class="btn" type="button" value="등록" 
    				onClick="go_save();">
    	<input class="btn" type="button" value="목록" 
    				onClick="go_mov();">
    </form>
    </article>
    
    <%@ include file="/admin/footer.jsp"%>

     

    // 입력란이 빈칸일 시 입력하라 안내하기
    function go_save(){
    	var theForm=document.frm;
    	// if(document.frm.kind.value=="")
    	if(theForm.kind.value==""){
    		alert("상품분류를 선택하세요");
    		theForm.kind.focus();
    	} else if(theForm.name.value==""){
    		alert("상품명를 입력하세요");
    		theForm.name.focus();
    	} else if(theForm.price1.value==""){
    		alert("원가를 입력하세요");
    		theForm.price1.focus();
    	}else if(theForm.price2.value==""){
    		alert("판매가를 입력하세요");
    		theForm.price2.focus();
    	}else if(theForm.content.value==""){
    		alert("상품상세를 입력하세요");
    		theForm.content.focus();
    	}else if(theForm.image.value==""){
    		alert("상품이미지를 입력하세요");
    		theForm.image.focus();
    	}else{
    		theForm.action="shop.do?command=adminProductWrite";
    		theForm.submit();
    	}
    }
    
    // 목록으로 돌아가기
    function go_mov(){
    	location.href="shop.do?command=adminProductList";
    }
    // 마진 계산하기
    function cal(){
    	if(document.frm.price2.value==""||
    		document.frm.price1.value=="") return;
    	document.frm.price3.value=document.frm.price2.value-document.frm.price1.value;
    }
     

     

    상품 등록 실행

    else if( command.equals("adminProductWrite") ) ac
                                = new AdminProductWriteAction();
    package com.sam.shop.controller.action.admin;
    
    import java.io.IOException;
    
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import com.sam.shop.controller.action.Action;
    import com.sam.shop.dao.AdminDao;
    import com.sam.shop.dto.AdminVO;
    import com.sam.shop.dto.ProductVO;
    import com.oreilly.servlet.MultipartRequest;
    import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
    
    public class AdminProductWriteAction implements Action {
    
    	@Override
    	public void execute(HttpServletRequest request, 
    			HttpServletResponse response) 
    			throws ServletException, IOException {
    		
    		String url = "shop.do?command=adminProductList"; 
    		
    		HttpSession session = request.getSession();
    	    AdminVO avo = (AdminVO) session.getAttribute("loginAdmin");    
    	    if (avo == null) {
    	    	url = "shop.do?command=admin";
    	    }else{
    	    	// 파일 업로드
    	    	ServletContext context=session.getServletContext();
    	    	String path=context.getRealPath("product_images");
    	    	
    	    	MultipartRequest multi=new MultipartRequest(
    	    			request,path,5*1024*1024,"UTF-8",
    	    			new DefaultFileRenamePolicy());
    	    	ProductVO pvo = new ProductVO();
    	    	pvo.setKind(multi.getParameter("kind"));
    	    	pvo.setName(multi.getParameter("name"));
    	    	pvo.setPrice1(Integer.parseInt(multi.getParameter("price1")));
    	    	pvo.setPrice2(Integer.parseInt(multi.getParameter("price2")));
    	    	pvo.setPrice3(Integer.parseInt(multi.getParameter("price3")));
    	    	pvo.setContent(multi.getParameter("content"));
    	    	pvo.setImage(multi.getFilesystemName("image"));
    	    	
    	    	AdminDao adao = AdminDao.getInstance();
    	    	adao.insertProduct(pvo);
    	    }
    	    response.sendRedirect(url);
    	}
    }

     

    AdminDao에 insertProduct 생성

    public void insertProduct(ProductVO pvo) {
    	String sql = "insert into product(pseq, kind, name,"
    			+ "price1, price2, price3, content, image)"
    			+ "values(product_seq.nextVal,?,?,?,?,?,?,?)";
    	con = Dbman.getConnection();
    	try {
    		pstmt = con.prepareStatement(sql);
    		pstmt.setString(1,pvo.getKind());
    		pstmt.setString(2,pvo.getName());
    		pstmt.setInt(3,pvo.getPrice1());
    		pstmt.setInt(4,pvo.getPrice2());
    		pstmt.setInt(5,pvo.getPrice3());
    		pstmt.setString(6,pvo.getContent());
    		pstmt.setString(7,pvo.getImage());
    		pstmt.executeUpdate();
    	} catch (SQLException e) { e.printStackTrace();
    	} finally { Dbman.close(con, pstmt, rs);  }
    }

     

     

    등록한 상품 상세보기

    productList.jsp에 표시된 부분 추가
     
    function go_detail(){
    	document.frm.action="shop.do?command=adminProductDetail&pseq="
                              +pseq;
    	document.frm.submit();
    }
    else if( command.equals("adminProductDetail") ) ac 
                                = new AdminProductDetailAction();
    package com.sam.shop.controller.action.admin;
    
    import java.io.IOException;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import com.sam.shop.controller.action.Action;
    import com.sam.shop.dao.ProductDao;
    import com.sam.shop.dto.AdminVO;
    import com.sam.shop.dto.ProductVO;
    
    public class AdminProductDetailAction implements Action {
    
    	@Override
    	public void execute(HttpServletRequest request, 
    			HttpServletResponse response) 
    			throws ServletException, IOException {
    		
    		String url = "admin/product/productDetail.jsp";
    
    		HttpSession session = request.getSession();
    		AdminVO avo = (AdminVO)session.getAttribute("loginAdmin");
    		if( avo == null ) url = "shop.do?command=admin"; 
    		else {
    			int pseq=Integer.parseInt(request.getParameter("pseq"));
    			ProductDao pdao = ProductDao.getInstance();
    			ProductVO pvo = pdao.getProduct( pseq );
    			
    			// 화면에 표시될 kind 종류를 배열로 선언
    			String [] kindList= {"0","Hells","Boots","Sandals",
    					"Shcakers","Slipers","On Sale"};
    			
    			// 현재 상품의 kind 값 추출
    			int index=Integer.parseInt(pvo.getKind());
    			
    			// index번째의 kindLIst 값을 request에 저장
    			request.setAttribute("kindList", kindList[index]);
    			request.setAttribute("productVO", pvo);
    		}
    		request.getRequestDispatcher(url).forward(request, response);
    	}
    }
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ include file="/admin/header.jsp"%>
    <%@ include file="/admin/sub_menu.jsp"%>
    
    <article>
    	<h1>상품 상세 보기</h1>
    	<table id="list">
    		<tr><th>상품분류</th><td colspan="5">${kind }</td></tr>
    		<tr><th align="center">상품명</th>
    			<td colspan="5">${productVO.name }</td></tr>
    		<tr>
    			<th>원가[A]</th>
    				<td width="60">${productVO.price1 }</td>
    			<th>판매가[B]</th>
    				<td width="60">${productVO.price2 }</td>
    			<th>[B-A]</th>
    				<td width="60">${productVO.price3 }</td></tr>
    		<tr><th>상세설명</th><td colspan="5">
    			<pre>${productVO.content }</pre></td></tr>
    		<tr><th>상품이미지</th><td colspan="5" align="center">
    			<img src="product_images/${productVO.image}" 
    				width="200pt"></td></tr>
    	</table>
    	<input class="btn" type="button" value="수정" 
    				onClick="go_mod('${productVO.pseq}')">
    	<input class="btn" type="button" value="목록" 
    				onClick="go_mov()">
    </article>
    <%@ include file="/admin/footer.jsp"%>
    
     
     
     
    등록된 상품 수정하기
    function go_mod(pseq){
    	var url="shop.do?command=adminProductUpdateForm&pseq="+pseq;
    	location.href=url;
    }
    else if( command.equals("adminProductUpdateForm") ) ac 
                            = new AdminProductUpdateFormAction();
    package com.sam.shop.controller.action.admin;
    
    import java.io.IOException;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import com.sam.shop.controller.action.Action;
    import com.sam.shop.dao.ProductDao;
    import com.sam.shop.dto.AdminVO;
    import com.sam.shop.dto.ProductVO;
    
    public class AdminProductUpdateFormAction implements Action {
    
    	@Override
    	public void execute(HttpServletRequest request, 
    			HttpServletResponse response)
    			throws ServletException, IOException {
    
    		String url = "admin/product/productUpdate.jsp";
    		HttpSession session = request.getSession();
    		AdminVO avo = (AdminVO)session.getAttribute("loginAdmin");
    		if( avo == null ) url = "shop.do?command=admin"; 
    		else {
    			int pseq=Integer.parseInt( request.getParameter("pseq"));
    			ProductDao pdao = ProductDao.getInstance();
    			ProductVO pvo = pdao.getProduct( pseq );
    			request.setAttribute("productVO", pvo);
    			String [] kindList= {"Hells","Boots","Sandals",
    					"Shcakers","Slipers","On Sale"};
    			request.setAttribute("kindList", kindList);
    		}
    		request.getRequestDispatcher(url).forward(request, response);
    	}
    }
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ include file="/admin/header.jsp"%>
    <%@ include file="/admin/sub_menu.jsp"%>
    
    <article>
    	<h1>상품수정${productVO.kind }</h1>
    	<form name="frm" method="post" enctype="multipart/form-data">
    		<input type="hidden" name="pseq" value="${productVO.pseq }">
    		<input type="hidden" name="oldImage" value="${productVO.image }">
    		<table id="list">
    			<tr><th>상품분류</th><td colspan="5">
    				<select name="kind">
    					<c:forEach items="${kindList}" var="kind" 
    						varStatus="status">
    						<c:choose>
    							<c:when test="${productVO.kind==status.count }">
    								<option value="${status.count }" 
    									selected="selected">${kind }</option>
    							</c:when>
    							<c:otherwise>
    								<option value="${status.count}">${kind}
    								</option>
    							</c:otherwise>
    						</c:choose>
    					</c:forEach>
    				</select></td></tr>
    			<tr><th>상품명</th><td width="343" colspan="5">
    				<input type="text" name="name" size="47"
    					maxlength="100" value="${productVO.name }"></td></tr>
    			<tr>
    				<th>원가[A]</th><td width="70">
    					<input type="text" name="price1" size="11"
    						onkeyup="cal();" value="${productVO.price1 }"></td>
    				<th>판매가[B]</th><td width="70">
    					<input type="text" name="price2" size="11"
    						onkeyup="cal();" value="${productVO.price2 }"></td>
    				<th>[B-A]</th><td width="72">
    					<input type="text" name="price3" size="11"
    						value="${productVO.price2-productVO.price1}"></td></tr>
    			<tr>
    				<th>베스트상품</th>
    				<td>
    					<c:choose>
    						<c:when test='${productVO.bestyn=="y" }'>
    							<input type="radio" name="bestyn" value="y"
    								checked="checked">사용
    							<input type="radio" name="bestyn" value="n">미사용
    						</c:when>
    						<c:otherwise>
    							<input type="radio" name="bestyn" value="y">사용
    							<input type="radio" name="bestyn" value="n"
    								checked="checked">미사용
    						</c:otherwise>
    					</c:choose></td>
    				<th>사용유무</th>
    				<td>
    					<c:choose>
    						<c:when test='${productVO.useyn=="y" }'>
    							<input type="radio" name="useyn" value="y"
    								checked="checked">사용
    							<input type="radio" name="useyn" value="n">미사용
    						</c:when>
    						<c:otherwise>
    							<input type="radio" name="useyn" value="y">사용
    							<input type="radio" name="useyn" value="n"
    								checked="checked">미사용
    						</c:otherwise>
    					</c:choose></td>
    			<tr><th>상세설명</th><td colspan="5">
    				<textarea name="content" rows="8" cols="70">
    					${productVO.content }
    				</textarea></td></tr>
    			<tr><th>상품이미지</th><td colspan="5">
    				<img src="product_images/${productVO.image }"
    					width="200pt"><br>
    				<input type="file" name="image"></td></tr>	
    		</table>
    		<input class="btn" type="button" value="수정" 
    				onClick="go_mod_save()">
    		<input class="btn" type="button" value="취소" 
    		onClick="location.href='shop.do?command=adminProductDetail$pseq=${productVO.pseq}'">
    	</form>
    </article>
    
    <%@ include file="/admin/footer.jsp"%>
    function go_mod_save(){
    	var theForm=document.frm;
    	// if(document.frm.kind.value=="")
    	if(theForm.kind.value==""){
    		alert("상품분류를 선택하세요");
    		theForm.kind.focus();
    	} else if(theForm.name.value==""){
    		alert("상품명를 입력하세요");
    		theForm.name.focus();
    	} else if(theForm.price1.value==""){
    		alert("원가를 입력하세요");
    		theForm.price1.focus();
    	}else if(theForm.price2.value==""){
    		alert("판매가를 입력하세요");
    		theForm.price2.focus();
    	}else if(theForm.content.value==""){
    		alert("상품상세를 입력하세요");
    		theForm.content.focus();
    	}else{
    		if(confirm('수정하시겠습니까?')){
    		theForm.action="shop.do?command=adminProductUpdate";
    		theForm.submit();
    		}
    	}
    }

     

    수정 실행

    else if( command.equals("adminProductUpdate") ) ac 
                               = new AdminProductUpdateAction();
    package com.sam.shop.controller.action.admin;
    
    import java.io.IOException;
    
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import com.sam.shop.controller.action.Action;
    import com.sam.shop.dao.AdminDao;
    import com.sam.shop.dto.AdminVO;
    import com.sam.shop.dto.ProductVO;
    import com.oreilly.servlet.MultipartRequest;
    import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
    
    public class AdminProductUpdateAction implements Action {
    
    	@Override
    	public void execute(HttpServletRequest request, 
    			HttpServletResponse response) 
    			throws ServletException, IOException {
    
    		String url = "shop.do?command=adminProductDetail";
    		HttpSession session = request.getSession();
    		AdminVO avo = (AdminVO)session.getAttribute("loginAdmin");
    		if( avo == null ) url = "shop.do?command=admin"; 
    		else {
    			ServletContext context=session.getServletContext();
    	    	String path=context.getRealPath("product_images");
    	    	MultipartRequest multi=new MultipartRequest(
    	    			request,path,5*1024*1024,"UTF-8",
    	    			new DefaultFileRenamePolicy());
    	    	ProductVO pvo = new ProductVO();
    	    	pvo.setPseq(Integer.parseInt(multi.getParameter("pseq")));
    	    	pvo.setKind(multi.getParameter("kind"));
    	    	pvo.setName(multi.getParameter("name"));
    	    	pvo.setPrice1(Integer.parseInt(multi.getParameter("price1")));
    	    	pvo.setPrice2(Integer.parseInt(multi.getParameter("price2")));
    	    	pvo.setPrice3(Integer.parseInt(multi.getParameter("price3")));
    	    	pvo.setContent(multi.getParameter("content"));
    	    	pvo.setUseyn(multi.getFilesystemName("useyn"));
    	    	pvo.setBestyn(multi.getFilesystemName("bestyn"));
    	    	if(multi.getFilesystemName("image")==null)
    	    		pvo.setImage(multi.getFilesystemName("oldImage"));
    	    	else pvo.setImage(multi.getFilesystemName("image"));
    	    	
    	    	AdminDao adao = AdminDao.getInstance();
    	    	adao.updateProduct(pvo);
    	    	url=url+"&pseq="+pvo.getPseq();
    		}
    	    request.getRequestDispatcher(url).forward(request, response);
    	}
    }

     

    AdminDao에 updateProduct 생성

    public void updateProduct(ProductVO pvo) {
    	String sql = "update product set kind=?, useyn=?, name=?,"
    			+ "price1=?, price2=?, price3=?, content=?, image=?,"
    			+ "bestyn=? where pseq=?";
    	con = Dbman.getConnection();
    	try {
    		pstmt = con.prepareStatement(sql);
    		pstmt.setString(1,pvo.getKind());
    		pstmt.setString(2,pvo.getUseyn());
    		pstmt.setString(3,pvo.getName());
    		pstmt.setInt(4,pvo.getPrice1());
    		pstmt.setInt(5,pvo.getPrice2());
    		pstmt.setInt(6,pvo.getPrice3());
    		pstmt.setString(7,pvo.getContent());
    		pstmt.setString(8,pvo.getImage());
    		pstmt.setString(9,pvo.getBestyn());
    		pstmt.setInt(10,pvo.getPseq());
    		pstmt.executeUpdate();
    	} catch (SQLException e) { e.printStackTrace();
    	} finally { Dbman.close(con, pstmt, rs);  }
    }

     

    best Item에 추가된 것을 확인


    검색하기

     
    function go_search(comm){
    	if(document.frm.key.value==""){
    		alert("검색버튼 사용 시에는 검색어 입력이 필수입니다.");
    		return;
    	}
    	var url="shop.do?command="+comm+"&page=1";
    	// 검색어로 검색한 결과의 1페이지로 이동
    	document.frm.action=url;
    	document.frm.submit();
    }

     

    AdminProductListAction 내용 수정

    AdminProductListAction에 코드 추가 및 수정
     
    String key="";
    if(request.getParameter("key")!=null) {
    	key=request.getParameter("key");
    	session.setAttribute("key", key);
    } else if( session.getAttribute("key") != null ) {
    	key=(String)session.getAttribute("key");
    } else {
    	session.removeAttribute("key");
    }
    int count = adao.getAllCount( "product",key );
    paging.setTotalCount(count);
    
    ArrayList<ProductVO> productList = adao.listProduct( paging,key );
    request.setAttribute("productList",productList);
    request.setAttribute("paging", paging);
    request.setAttribute("key", key);

     

    AdminDao 수정

    public ArrayList<ProductVO> listProduct(Paging paging, String key){
    	ArrayList<ProductVO> list = new ArrayList<ProductVO>();
    	String sql = "select * from ( "
    			+ " select * from ( "
    			+ " select rownum as rn, p.* from"
    			+ " ((select * from product "
    			+ "where name like '%'||?||'%' "
    			+ "order by pseq desc) p) "
    			+ " ) where rn>=? "
    			+ " ) where rn<=? ";
    	con = Dbman.getConnection();
    	try {
    		pstmt = con.prepareStatement(sql);
    		pstmt.setString(1, key);
    		pstmt.setInt(2, paging.getStartNum() );
    		pstmt.setInt(3,  paging.getEndNum() );
    		rs = pstmt.executeQuery();
    		while(rs.next()) {
    	    	ProductVO pvo = new ProductVO();
    	    	pvo.setPseq(rs.getInt("pseq"));
    	    	pvo.setIndate(rs.getTimestamp("indate"));
    	    	pvo.setName(rs.getString("name"));
    	    	pvo.setPrice1(rs.getInt("price1"));
    	    	pvo.setPrice2(rs.getInt("price2"));
    	    	pvo.setPrice3(rs.getInt("price3"));
    	    	pvo.setImage(rs.getString("image"));
    	    	pvo.setUseyn(rs.getString("useyn"));
    	        pvo.setBestyn(rs.getString("bestyn"));
    	    	list.add(pvo);
    		} 
    	}catch (SQLException e) { e.printStackTrace();
    	} finally { Dbman.close(con, pstmt, rs);  }
    	return list;
    }
    
    public int getAllCount( String tableName, String key ) {
    	int count = 0;
    	String sql  = "select count(*) as cnt from " + tableName
    			+" where name like '%'||?||'%'";
    	con = Dbman.getConnection();
    	try {
    		pstmt = con.prepareStatement(sql);
    		pstmt.setString(1,key);
    		rs = pstmt.executeQuery();
    		if( rs.next() ) count = rs.getInt("cnt");
    	} catch (SQLException e) { e.printStackTrace();
    	} finally { Dbman.close(con, pstmt, rs);  }
    	return count;
    }
     

     

    전체보기

    function go_total(comm){
    	document.frm.key.value="";
    	document.frm.action="shop.do?command="+comm+"&page=1";
    	document.frm.submit();
    }
    전체보기 클릭 시

     

     

    'WEB > ERMaster' 카테고리의 다른 글

    [ERMaster] shoppingmall - Q&A, paging  (0) 2022.09.10
    [ERMaster] shoppingmall - order  (0) 2022.09.10
    [ERMaster] shoppingmall - cart  (0) 2022.09.10
    [ERMaster] shoppingmall - category  (0) 2022.09.10
    [ERMaster] shoppingmall - find ID, PW  (0) 2022.09.10

    댓글

Designed by Tistory.