반응형
부트스트랩 더 끼얹기2 - 부트스트랩을 이용해서 페이지 정리~
1. list.jsp
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | <%@ 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"%> <%@ taglib prefix="layoutTag" tagdir="/WEB-INF/tags"%> <layoutTag:layout> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>List</title> </head> <body> <div class="container"> <div class="col-xs-12" style="margin:15px auto;"> <label style="font-size:20px;"><span class="glyphicon glyphicon-list-alt"></span>게시글 목록</label> <button class="btn btn-primary btn-sm" style="float:right;" onclick="location.href='/insert'">글쓰기</button> </div> <div class="col-xs-12"> <table class="table table-hover"> <tr> <th>No</th> <th>Subject</th> <th>Writer</th> <th>Date</th> </tr> <c:forEach var="l" items="${list}"> <tr onclick="location.href='/detail/${l.bno}'"> <td>${l.bno}</td> <td>${l.subject}</td> <td>${l.writer}</td> <td> <fmt:formatDate value="${l.reg_date}" pattern="yyyy.MM.dd HH:mm:ss"/> </td> </tr> </c:forEach> </table> </div> </div> </body> </html> </layoutTag:layout> | cs |
2. insert.jsp
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="layoutTag" tagdir="/WEB-INF/tags"%> <layoutTag:layout> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert Form</title> </head> <body> <div class="container"> <div class="col-xs-12" style="margin:15px auto;"> <label style="font-size:20px;"><span class="glyphicon glyphicon-edit"></span>게시글 작성</label> </div> <div class="col-xs-12"> <form action="/insertProc" method="post" enctype="multipart/form-data"> <!-- 추가 --> <div class="form-group"> <label for="subject">제목</label> <input type="text" class="form-control" id="subject" name="subject" placeholder="제목을 입력하세요."> </div> <div class="form-group"> <label for="writer">작성자</label> <input type="text" class="form-control" id="writer" name="writer" placeholder="내용을 입력하세요."> </div> <div class="form-group"> <label for="content">내용</label> <textarea class="form-control" id="content" name="content" rows="3"></textarea> </div> <div class="form-group"> <label for="file">파일 업로드</label> <input type="file" id="file" name="files"> </div> <button type="submit" class="btn btn-primary btn-sm" style="float:right;">작성</button> </form> </div> </div> </body> </html> </layoutTag:layout> | cs |
3.detail.jsp
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | <%@ 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"%> <%@ taglib prefix="layoutTag" tagdir="/WEB-INF/tags"%> <layoutTag:layout> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Detail</title> </head> <body> <div class="container"> <div class="col-xs-12" style="margin:15px auto;"> <label style="font-size:20px;"><span class="glyphicon glyphicon-list-alt"></span>게시글 상세</label> </div> <div class="col-xs-12"> <form action="/insertProc" method="post"> <dl class="dl-horizontal"> <dt>제목</dt> <dd>${detail.subject}</dd> <dt>작성자</dt> <dd>${detail.writer}</dd> <dt>작성날짜</dt> <dd> <fmt:formatDate value="${detail.reg_date}" pattern="yyyy.MM.dd HH:mm:ss"/> </dd> <dt>첨부파일</dt> <dd><a href="/fileDown/${files.bno}">${files.fileOriName}</a></dd> <dt>내용</dt> <dd>${detail.content}</dd> </dl> </form> <div class="btn-group btn-group-sm" role="group" style="float:right;"> <button type="button" class="btn btn-default" onclick="location.href='/delete/${detail.bno}'">삭제</button> <button type="button" class="btn btn-default" onclick="location.href='/update/${detail.bno}'">수정</button> <button type="button" class="btn btn-default" onclick="location.href='/list'"> 목록 </button> </div> </div> </div> </body> </html> </layoutTag:layout> | cs |
4.update.jsp
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 31 32 33 34 35 36 37 | <%@ 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="layoutTag" tagdir="/WEB-INF/tags"%> <layoutTag:layout> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <div class="container"> <div class="col-xs-12" style="margin:15px auto;"> <label style="font-size:20px;"><span class="glyphicon glyphicon-edit"></span>게시글 수정</label> </div> <div class="col-xs-12"> <form action="/updateProc" method="post"> <div class="form-group"> <label for="subject">제목</label> <input type="text" class="form-control" id="subject" name="subject" value="${detail.subject}"> </div> <div class="form-group"> <label for="content">내용</label> <textarea class="form-control" id="content" name="content" rows="3">${detail.content}</textarea> </div> <input type="hidden" name="bno" value="${detail.bno}"/> <button type="submit" class="btn btn-primary btn-sm" style="float:right;">수정</button> </form> </div> </div> </body> </html> </layoutTag:layout> | cs |
*참고 - jstl 날짜 포맷
태그 추가 : <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
포맷 지정 : <fmt:formatDate value="${detail.reg_date}" pattern="yyyy.MM.dd HH:mm:ss"/>
목록
글작성
글상세
글수정
반응형~
반응형
'SpringBoot 게시판 만들기' 카테고리의 다른 글
스프링부트(SpringBoot) 게시판 만들기14 - 댓글 기능 구현(ajax) (31) | 2017.09.10 |
---|---|
스프링부트(SpringBoot) 게시판 만들기13 - 간단하게 application.properties 사용하기 (3) | 2017.09.07 |
스프링부트(SpringBoot) 게시판 만들기11 - 부트스트랩 더 끼얹기1 (2) | 2017.09.05 |
스프링부트(SpringBoot) 게시판 만들기10 - Multipart 파일 다운로드 (2) | 2017.09.05 |
스프링부트(SpringBoot) 게시판 만들기9 - Multipart 파일 업로드 (7) | 2017.09.02 |
댓글