Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- 오버로딩
- 생성자
- 이클립스
- 국제화
- JavaScript
- 클래스
- 메소드
- paint
- AWT
- 전화걸기
- Android
- struts2
- Menu
- oracle
- layout
- 어노테이션
- 기본
- OGNL
- Eclips
- mybatis
- 배열
- JSP
- Graphic
- 에러페이지
- Spring
- 안드로이드
- 예외처리
- 메서드
- Java
- HTML
Archives
- Today
- Total
note
갤러리 게시판 프로그램 본문
예제
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>게시판</title> <script type="text/javascript"> function searchMessage(){ if(document.search.keyWord.value==""){ alert("검색어를 입력하세요"); document.search.keyWord.focus(); return false; } return true; } </script> </head> <body> <center> <form action="list.do" name="search" method="get" onsubmit="return searchMessage()"> <table width="200" border="0" align="center" cellpadding="4" cellspacing="0"> <tr> <td align="center" valign="bottom"> <select name="keyField"> <option value="subject">제목</option> <option value="writer">이름</option> <option value="content">내용</option> </select> </td> <td> <input type="text" size=16 name="keyWord"> </td> <td> <input type="submit" value="찾기"></td> </tr> </table> </form> <table width="700" cellpadding="0" cellspacing="0"> <tr> <td><b>전체 글:${page.count}</b></td> <td align="right"> <a href="writeForm.do">글쓰기</a> </td> </tr> </table> <c:if test="${page.count == 0}"> <table width="700" border="1" cellpadding="0" cellspacing="0"> <tr> <td align="center"> 게시판에 저장된 글이 없습니다. </td> </tr> </table> </c:if> <c:if test="${page.count > 0}"> <table border="1" width="700" cellpadding="0" cellspacing="0" align="center"> <tr height="30"> <td align="center" width="50" >번 호</td> <td align="center" width="250" >제 목</td> <td align="center" width="100" >작성자</td> <td align="center" width="150" >작성일</td> <td align="center" width="50" >조 회</td> <td align="center" width="100" >IP</td> </tr> <c:set var="number" value="${page.number}"/> <c:forEach var="article" items="${articleList}"> <tr height="30"> <td align="center" width="50" > ${number} <c:set var="number" value="${number - 1}"/> </td> <td width="250" > <c:if test="${! empty article.image}"> <img src="/album/upload/${article.image}" width="70" height="70" border="0"> </c:if> <a href="content.do?num=${article.num}"> ${article.subject}</a> </td> <td align="center" width="100"> ${article.writer} </td> <td align="center" width="150">${article.reg_date} </td> <td align="center" width="50">${article.readcount}</td> <td align="center" width="100" >${article.ip}</td> </tr> </c:forEach> </table> </c:if> <c:if test="${page.count > 0}"> <c:set var="pageCount" value="${(page.count - 1) / page.pageSize + 1}"/> <c:set var="pageBlock" value="${10}"/> <fmt:parseNumber var="rs" value="${(currentPage - 1) / pageBlock}" integerOnly="true" /> <c:set var="startPage" value="${rs*pageBlock+1}"/> <c:set var="endPage" value="${startPage + pageBlock-1}"/> <c:if test="${endPage > pageCount}"> <c:set var="endPage" value="${pageCount}"/> </c:if> <c:if test="${startPage > pageBlock}"> <a href="list.do?pageNum=${startPage - pageBlock }&keyField=${page.keyField}&keyWord=${page.keyWord}">[이전]</a> </c:if> <c:forEach var="i" begin="${startPage}" end="${endPage}"> <c:if test="${i == page.currentPage}"> [${i}] </c:if> <c:if test="${i != page.currentPage}"> <a href="list.do?pageNum=${i}&keyField=${page.keyField}&keyWord=${page.keyWord}">[${i}]</a> </c:if> </c:forEach> <c:if test="${endPage < pageCount}"> <a href="list.do?pageNum=${startPage + pageBlock}&keyField=${page.keyField}&keyWord=${page.keyWord}">[다음]</a> </c:if> </c:if> </center> </body> </html>
'JSP > 기본' 카테고리의 다른 글
날짜 며칠전 / 몇분전 / 몇년전 으로 치환 (0) | 2012.03.13 |
---|---|
JSP - Oracle Clob 사용법 (0) | 2012.02.20 |
방명록 프로그램 MODEL2 (0) | 2012.02.16 |
회원관리 프로그램 가입,로그인 MVC MODEL2방식 (1) | 2012.02.16 |
MVC 회원관리 프로그램 Model2 (0) | 2012.02.15 |