IT/Java Spring

Spring MVC 기본 게시판 예제 만들기 - 2. 페이지번호 삽입작업

Millennials 2020. 6. 18. 10:24

PagingUtil.java
0.00MB

1) pageutil 패키지 만들고 첨부파일 삽입



2) DAO 작업



3)service 작업



4) Controller 작업



5)view 작업


<%@ 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>게시판 목록</title>
<link rel="stylesheet" href="${pageContext.request.contextPath }/resources/css/style.css">
</head>
<body>
<div class="page-main-style">
	<h2>게시판 목록</h2>
	<div class="align-right">
		<input type="button" value="등록" onclick="location.href='insert.do'">
	</div>
	<c:if test="${count == 0 }">
		<div class="result-display">출력할 내용이 없습니다.</div>
	</c:if>
	<c:if test="${count > 0 }">
		<table>
			<tr>
				<th>번호</th>
				<th>제목</th>
				<th>작성자</th>
				<th>작성일</th>
			</tr>
			<c:forEach var="board" items="${list }">
			<tr>
				<td>${board.num }</td>
				<td><a href="detail.do?num=${board.num }">${board.title }</a></td>
				<td>${board.writer }</td>
				<td>${board.reg_date }</td>
			</tr>
			</c:forEach>
		</table>
		<div class="align-center">${pagingHtml}</div>
	</c:if>
</div>
</body>
</html>

6)실행 및 오류 체크


 

반응형