<% /*============================================================================================== * Project Title : * File Name : * Include : * Used DB Table : notice * Used Class : * Description : °Ô½ÃÆÇ ¸®½ºÆ® * Programmer : °­ÁÖ¿ë * First Write : 2010.04.28 * Last Update : ==============================================================================================*/ %> <%@ page contentType="text/html;charset=euc-kr" %> <%@ include file="/include/in_Import.jsp" %> <%@ include file="/include/in_Function.jsp" %> <% int PageAuth = 1; String menuId = request.getParameter("menuId"); if(menuId == null || menuId.equals("")) menuId = "41"; %> <%! static { try { new kr.co.slight.jinhae.pool.JDCConnectionDriver("org.postgresql.Driver","jdbc:postgresql:hanmaum","postgres",""); } catch(Exception e) { System.out.println("

JDCConnectionDriver Error : " + e.toString()); } } %> <% /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SESSION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ String spage = request.getParameter("spage"); if (spage == null) spage = "1"; int iPage = Integer.parseInt(spage); String keytype = request.getParameter("keytype"); String keyword = request.getParameter("keyword"); if(keytype == null || keytype.equals("")) { keytype = "subject"; } if(keyword == null || keyword.equals("")) { keyword = ""; } else { keyword = sutil.toEucKr(keyword); } int totalCnt = 0; //±ÛÀÇ ÃÑ °¹¼ö int totalPage; //ÃÑ ÆäÀÌÁö °¹¼ö int pageSize = 10; //ÇÑÆäÀÌÁö¿¡ º¸¿©ÁÙ ±ÛÀÇ ÃÖ´ë °¹¼ö int blockSize =10; //ÇÑ È­¸é¿¡ º¸¿©ÁÙ ÃÖ´ë ÆäÀÌÁö °¹¼ö int blockPage; //ÇÑ È­¸é¿¡ º¸¿©Áö´Â ÆäÀÌÁö Áß Ã¹¹ø° ÆäÀÌÁö ¹øÈ£ int start_no = (iPage-1)*pageSize + 1; //ÇØ´ç ÆäÀÌÁöÀÇ Ã¹¹ø° row number int end_no = iPage*pageSize; //ÇØ´ç ÆäÀÌÁöÀÇ ¸¶Áö¸· row number(ÃÖ´ë°ª) Connection conn = null; Statement stmt = null; ResultSet rs = null; ResultSet rtList = null; try { StringBuffer query = new StringBuffer(); StringBuffer query_cnt = new StringBuffer(); if ( keyword == null || keyword.equals("") ) { query_cnt.append(" SELECT COUNT(*) "); query_cnt.append(" FROM NOTICE "); query_cnt.append(" WHERE STATE = '1' "); query.append(" select * "); query.append(" from notice "); query.append(" where state = '1' "); query.append(" order by no desc "); query.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(start_no-1); } else { query_cnt.append(" SELECT COUNT(*) "); query_cnt.append(" FROM NOTICE "); query_cnt.append(" WHERE ").append(keytype).append(" LIKE '%").append(keyword).append("%'"); query_cnt.append(" AND STATE = '1' "); query.append("SELECT * "); query.append(" FROM NOTICE "); query.append(" WHERE ").append(keytype).append(" LIKE '%").append(keyword).append("%' "); query.append(" AND STATE ='1' "); query.append(" ORDER BY NO DESC "); query.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(start_no-1); } conn = DriverManager.getConnection("jdbc:jdc:jdcpool"); stmt = conn.createStatement(); rs = stmt.executeQuery(query_cnt.toString()); while(rs.next()) { totalCnt = rs.getInt(1); } rs.close(); totalPage = ((int) (totalCnt - 1)/pageSize) + 1; blockPage = ((int) (iPage -1)/blockSize) * blockSize + 1; rtList = stmt.executeQuery(query.toString()); int loopSize = Math.min(blockPage + blockSize, totalPage + 1); int rowNum = totalCnt - 10 * (iPage - 1); %> ¹«Á¦ ¹®¼­ <%@ include file="/hanmaum/Cs/04_subimg.jsp" %>
<%@ include file="/hanmaum/Cs/left_menu.jsp" %>
Ȩ > °í°´¼¾ÅÍ > °øÁö»çÇ×
 
<% if (totalCnt > 0) { int i = totalCnt; int no = 0; String subject = ""; String regdate = ""; while (rtList.next()) { no = rtList.getInt("no"); subject = rtList.getString("subject"); regdate = rtList.getString("reg_dt").toString().substring(0, 10); subject = cutoffString(subject, 80); %> <% } } else { %> <% } %>
<%= rowNum-- %> <%= subject %> <%= regdate %>
µî·ÏµÈ °Ô½Ã¹°ÀÌ ¾ø½À´Ï´Ù.
<% //ÀÌÀü ÆäÀÌÁö if ( iPage == 1 ) { %> <% } else { %> <% } // ÆäÀÌÁö Loop for ( int j=blockPage; j [<%=j%>] <% } else { %> [<%=j%>] <% } } /*----------------------------------------- ´ÙÀ½ ÆäÀÌÁö -----------------------------------------*/ if ( iPage == totalPage ) { %> <% } else { %> <% } %>
<%@ include file="/hanmaum/bottom.jsp" %> <% rs.close(); stmt.close(); conn.close(); } catch (Exception e) { if ( rs != null ) rs.close(); if ( stmt != null ) stmt.close(); if ( conn != null ) conn.close(); // ¿¡·¯ÆäÀÌÁö·Î À̵¿............ out.println("JSP >> Slight Exception in /Cs/csnot01.jsp : " + e.toString()); } %>