728x90
board
게시판
board.jsp 구성
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="UTF-8"%>
<%@ page import="java.io.PrintWriter"%>
<%@ page import="bbs.BbsDAO"%>
<%@ page import="bbs.Bbs"%>
<%@ page import="java.util.ArrayList"%>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
a, a:hover {
color: #000000;
text-decoration: none;
}
</style>
</head>
<body>
<jsp:include page="head.jsp" flush="false" />
<%
String userID = null;
if (session.getAttribute("userID") != null) {
userID = (String) session.getAttribute("userID");
}
int pageNumber = 1;
if (request.getParameter("pageNumber") != null) {
pageNumber = Integer.parseInt(request.getParameter("pageNumber"));
}
%>
<div class="container">
<div class="row">
<table class="table table-striped" style="text-align: center; border: 1px solid #dddddd">
<thead>
<tr>
<th style="background-color: #eeeeee; text-align: center;">번호</th>
<th style="background-color: #eeeeee; text-align: center;">제목</th>
<th style="background-color: #eeeeee; text-align: center;">작성자</th>
<th style="background-color: #eeeeee; text-align: center;">작성일</th>
</tr>
</thead>
<tbody>
<%
BbsDAO bbsDAO = new BbsDAO();
ArrayList<Bbs> list = bbsDAO.getList(pageNumber);
for(int i = 0; i < list.size(); i++) {
%>
<tr>
<td><%= list.get(i).getBbsID() %></td>
<td><a href="view.jsp?bbsID=<%= list.get(i).getBbsID()%>"><%= list.get(i).getBbsTitle() %></a></td>
<td><%= list.get(i).getUserID() %></td>
<td><%= list.get(i).getBbsDate() %></td>
</tr>
<%
}
%>
</tbody>
</table>
<%
if(pageNumber != 1) {
%>
<a href="board.jsp?pageNumber=<%=pageNumber - 1%>" class="btn btn-success btn-arrow-left">이전</a>
<%
}
%>
<%
if(bbsDAO.nextPage(pageNumber)) {
%>
<a href="board.jsp?pageNumber=<%=pageNumber + 1%>" class="btn btn-success btn-arrow-right">다음</a>
<%
}
%>
<a href="write.jsp" class="btn btn-primary pull-right">글쓰기</a>
</div>
</div>
<jsp:include page="footer.jsp" flush="false" />
</body>
</html>
728x90
'Back-End > JSP & Thymeleaf' 카테고리의 다른 글
10.게시판 글수정 기능 (0) | 2020.12.25 |
---|---|
9.게시판 글쓰기 기능 (0) | 2020.12.25 |
7.게시판 데이터 관리 및 DB와 연결하기 (0) | 2020.12.25 |
6.로그인 확인여부 기능 (0) | 2020.12.25 |
5.로그인 폼과 로그인 기능 구현하기 (0) | 2020.12.25 |