public void loadList ( PrintWriter out ) {
SearchItem searchItem = new SearchItem ( ) ;
try {
searchItem.loadDriver ( ) ;
}
catch ( java.lang.ClassNotFoundException e ) {
System.err.print ( "ClassNotFoundException:" ) ;
System.err.println ( e.getMessage ( ) ) ;
}
catch ( Exception e ) {
System.err.println ( e ) ;
}
try {
bd = searchItem.search ( SearchCode, SearchString ) ;
if ( bd == null ) return ;
totalListNum = searchItem.getTotalListNum ( ) ;
totalPage = searchItem.getTotalPage ( ) ;
pageListNum = searchItem.getPageListNum ( ) ;
}
catch ( SQLException ex ) {
System.err.println ( "SQLException :" + ex.getMessage ( ) ) ;
}
}
public void doGet ( HttpServletRequest req, HttpServletResponse res ) 	throws IOException {
res.setContentType ( "text/html ;charset = euc-kr" ) ;
PrintWriter out = res.getWriter ( ) ;
page = Integer.parseInt ( ( req.getParameter ( "page" ) == null ) ?"0":req.getParameter ( "page" ) ) ;
SearchCode = req.getParameter ( "searchcode" ) ;
SearchString = req.getParameter ( "searchstring" ) ;
if ( page == 0 ) page=1;
out.println ( HTMLLib.getHTMLTitle ( "게시판 보기" ) ) ;
out.println ( "<body background = /images/back.gif><center><br>" ) ;
out.println ( "<img src = \"/images/title.gif\" width = \"273\" height = \"34\"> <br><br>" ) ;
out.println ( "<table border = 0 width = 600 cellspacing = 1 cellpadding = 5 bgcolor = #995F0F style = \"font-size:12px\">" ) ;
out.println ( "		<TR bgColor = #995F0F> " ) ;
out.println ( "		<td colspan = \"4\" align = middle height = 4></td>" ) ;
out.println ( "		</TR>" ) ;
out.println ( "		<TR bgColor = #D3BB9A> " ) ;
out.println ( "			<TH width = \"60\" height = \"32\" align = middle><FONT color = \"#400000\" size = 2 face = \"돋움\">번호</FONT></TH>" ) ;
out.println ( "			<TH width = \"100\" height = \"32\" align = middle><FONT color = \"#400000\" size = 2 face = \"돋움\">성 명</FONT></TH>" ) ;
out.println ( "			<TH width = \"320\" height = \"32\" align = middle bgcolor = \"#D3BB9A\"><FONT color = \"#400000\" size = 2 face = \"돋움\">제 목</FONT></TH>" ) ;
out.println ( "			<TH width = \"120\" height = \"32\" align = middle><FONT color = \"#400000\" size = 2 face = \"돋움\">등록일</FONT></TH>" ) ;
out.println ( "</TR>" ) ;
loadList ( out ) ;
if ( ( bd == null ) || ( totalListNum == 0 ) ) {
out.println ( "<tr bgColor = #F3EBE2><td colspan = 4 align = left>"+HTMLLib.getMakeLink ( HTMLLib.SERVERURL+"input.html","<img src = \"/images/write.gif\" width = \"40\" height = \"17\" border = \"0\">" ) ) ;
out.println ( "</table>" ) ;
out.println ( "<font color = red><b>입력된 글이 없습니다.</b></font>" ) ;
return ;
}
if ( page<totalPage ) pageListNum=HTMLLib.LINENUM;
else pageListNum = totalListNum - (totalPage-1)*HTMLLib.LINENUM;
for ( int j = 0 ,i = ( bd.length-HTMLLib.LINENUM* ( page-1 ) ) -1 ; j<pageListNum ; i--,j++ ) {
out.println ( "<tr bgcolor = #F3EBE2 height = \"20\" onmouseover = \"this.bgColor = '#FFE6AA'\" onmouseout = \"this.bgColor = '#F3EBE2'\"><td align = center><font size = 2>"+ bd[i].num +"</font></td>" ) ;
out.println ( "<td align = center><font size = 2>"+bd[i].getLinkName ( ) +"</font></td>" ) ;
out.println ( "<td><font size = 2>"	+HTMLLib.getMakeLink ( HTMLLib.SERVLETURL + "BoardView_db?num=" + bd[i].num + "&page=" + page,bd[i].title) + "</font></td>");
out.println ( "<td align = center><font size = 2>"+HTMLLib.getFormattedDate ( bd[i].date ) +"</font></td>" ) ;
}
out.println ( " <TR bgColor = #D3BB9A> " ) ;
out.println ( " <TD colspan = \"4\" height = 3></TD>" ) ;
out.println ( " <TR> " ) ;
out.println ( "</table><table border = 0 width = 600><tr><td colspan = 4 align = right height = 40>" ) ;
out.println ( "<form action = "+HTMLLib.SERVLETURL+"BoardSearch_db method = get>" ) ;
out.println ( "<select name = searchcode>" ) ;
out.println ( "<option value = 'namesearch'>글쓴이</option>" ) ;
out.println ( "<option value = 'titlesearch'>제목</option>" ) ;
out.println ( "</select>" ) ;
out.println ( "<input type = text name = searchstring size = 20>" ) ;
out.println ( "<input type = submit value = '찾기'>" ) ;
out.println ( "</td></form></tr><tr><td colspan = 4 align = left>"	+HTMLLib.getMakeLink ( HTMLLib.SERVERURL +"input.html","<img src=\"/images/write.gif\" width=\"40\" height=\"17\" border=\"0\">"));
out.println ( HTMLLib.getMakeLink ( HTMLLib.SERVLETURL + "BoardList_db","<img src = \"/images/boardListIcon.gif\" width = \"40\" height = \"17\" border = \"0\">" ) ) ;
out.println ( "</td></tr><tr><td colspan = 4 align = right>" ) ;
if ( page!= 1 ) out.println(HTMLLib.getMakeLink(HTMLLib.SERVLETURL+"BoardSearch_db?page="+ (page-1)+"&searchcode="+SearchCode+"&searchstring="+SearchString,"<<이전 "));
if ( totalPage!= page ) out.println(HTMLLib.getMakeLink(HTMLLib.SERVLETURL+"BoardSearch_db?page=" +(page+1)+"&searchcode="+SearchCode+"&searchstring="+SearchString," 다음>>"));
out.println ( " </td></tr>" ) ;
out.println ( "</table>" ) ;
out.println ( "</center>" ) ;
out.println ( "</body></html>" ) ;
}
public String hangulTo ( String str ) {
if ( str == null ) return null;
try {
return new String ( str.getBytes ( "KSC5601" ) , "8859_1" ) ;
} catch ( UnsupportedEncodingException e ) {
}
return null ;
}
