<%@ page contentType="text/html;charset=euc-kr" %> <%@ page import="java.sql.*" %> <%! public String toParamStr(String oldStr, String newStr) { try { if (oldStr == null || oldStr.equals("")) { return newStr; } else { return oldStr.trim(); } } catch (Exception e) { return oldStr; } } public String toEucKr(String s) { try { return new String(s.getBytes("iso-8859-1"), "EUC-KR"); } catch (Exception e) { return s; } } public String convertDBtoWEB (String str) { try { str = replaceStr(str, "&", "&"); str = replaceStr(str, "<", "<"); str = replaceStr(str, ">", ">"); str = replaceStr(str, """, "\""); str = replaceStr(str, "'", "\'"); str = replaceStr(str, "\", "\\"); str = replaceStr(str, " ", " "); } catch(Exception e){ System.out.println("<< convertWEBtoDB (String str) >> Error : " + e.getMessage()); } return str; } public String replaceStr(String stro, String s1, String s2) { int i = 0; String rStr = ""; while( stro.indexOf(s1) > -1 ) { i = stro.indexOf(s1); rStr += stro.substring(0,i)+s2; stro = stro.substring(i+s1.length()); } return rStr+stro; } %> <% String spage = request.getParameter("spage"); int no = Integer.parseInt(request.getParameter("no")); String menuId = request.getParameter("menuId"); if(menuId == null || menuId.equals("")) menuId = "11"; String galtype = toParamStr(request.getParameter("galtype"), "2"); String galseason = toParamStr(request.getParameter("galseason"), "1"); if (spage == null) spage = "1"; %> <% Connection conn = null; try { // Ŭ·¡½º ·Îµå Class.forName("org.postgresql.Driver"); conn = DriverManager.getConnection("jdbc:postgresql:hanmaum", "postgres", ""); } catch(Exception e) { } PreparedStatement ps = null; ResultSet rs = null; ResultSet rsList = null; String searchPage = toParamStr(request.getParameter("searchPage"), "1"); String searchType = toParamStr(request.getParameter("searchType"), "01"); String searchWord = toEucKr(toParamStr(request.getParameter("searchWord"), "")); String searchLine = toParamStr(request.getParameter("searchLine"), "10"); //ÇÑÆäÀÌÁö¿¡ º¸¿©ÁÙ ±ÛÀÇ ÃÖ´ë °¹¼ö int totalCnt = 0; //±ÛÀÇ ÃÑ °¹¼ö int totalPage; //ÃÑ ÆäÀÌÁö °¹¼ö int blockSize = 10; //ÇÑ È­¸é¿¡ º¸¿©ÁÙ ÃÖ´ë ÆäÀÌÁö °¹¼ö int blockPage; //ÇÑ È­¸é¿¡ º¸¿©Áö´Â ÆäÀÌÁö Áß Ã¹¹ø° ÆäÀÌÁö ¹øÈ£ int start_no = (Integer.parseInt(searchPage)-1)*Integer.parseInt(searchLine) + 1; //ÇØ´ç ÆäÀÌÁöÀÇ Ã¹¹ø° row number int end_no = Integer.parseInt(searchPage)*Integer.parseInt(searchLine); //ÇØ´ç ÆäÀÌÁöÀÇ ¸¶Áö¸· row number(ÃÖ´ë°ª) String sql = ""; /*sql = " select count(*) as cnt from qna where type = ? "; try { ps = conn.prepareStatement(sql); ps.setString(1, galtype); rs = ps.executeQuery (); if ( rs.next() ) { totalCnt = rs.getInt ("cnt"); } } catch (Exception e) { System.out.println("tqna_List Error : " + e.toString()); } finally { try { if (rs != null) rs.close(); if (ps != null) ps.close(); } catch (Exception e) { System.out.println("Close Error : " + e.toString()); } }*/ totalPage = ( (int) (totalCnt - 1)/Integer.parseInt(searchLine) ) + 1; blockPage = ( (int) (Integer.parseInt(searchPage) -1)/blockSize ) * blockSize + 1; try { sql = " select no, type, title, photo1, photo2, photo3, article, writer, wdate, ip, passwd, hitcnt, state, rpl_no "; sql += " from gallery where type = ? and state = '1' and no = ? "; ps = conn.prepareStatement(sql); ps.setString(1, galtype); ps.setInt(2, no); rsList = ps.executeQuery (); if(rsList.next()) { String query_insert = " UPDATE gallery SET hitcnt = hitcnt+1 WHERE type = ? and state = '1' and no = ? "; ps = conn.prepareStatement(query_insert); ps.setString(1, galtype); ps.setInt(2, no); ps.executeUpdate(); String content = convertDBtoWEB(rsList.getString(7)); String view_content = replaceStr(content, " ", " "); view_content = replaceStr(view_content, "\n", "
"); %> ¹«Á¦ ¹®¼­ <%@ include file="/hanmaum/Intro/01_subimg.jsp" %>
<%@ include file="/hanmaum/gallery/left_menu.jsp" %>
Ȩ > °¶·¯¸® > <% if(galtype.equals("1")) { %>ÁÖº¯Ç³°æ<% } else if(galtype.equals("2")) { %>ÇѸ¶À½¿¬¼ö¿ø Àü°æ<% } else if(galtype.equals("3")) { %>½Ç³»ÀÎÅ׸®¾î<% } else if(galtype.equals("4")) { %>»ç¿ëÀÚ°¶·¯¸®<% } %><% if(galtype.equals("1") || galtype.equals("2")) { %> > <% if(galseason.equals("1")) { %>º½<% } else if(galseason.equals("2")) { %>¿©¸§<% } else if(galseason.equals("3")) { %>°¡À»<% } else if(galseason.equals("4")) { %>°Ü¿ï<% } %><% } %>
<% if(galtype.equals("1")) { %> <% } else if(galtype.equals("2")) { %> <% } else if(galtype.equals("3")) { %> <% } else if(galtype.equals("4")) { %> <% } %>
 
<%= rsList.getString(3) %> <%= rsList.getString(9) %>
<% if(rsList.getString(4).length()>2){ %>

<% } if(rsList.getString(5).length()>2){ %>

<% } if(rsList.getString(6).length()>2){ %>

<% } %>
<%= view_content %>
¼öÁ¤
  <%@ include file="/hanmaum/bottom.jsp" %>     <% } rs.close(); ps.close(); conn.close(); } catch (Exception e) { if ( rs != null ) rs.close(); if ( ps != null ) ps.close(); if ( conn != null ) conn.close(); } %>