반응형
게시글 상세(detail)
1. 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 | <%@ 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 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> <h2> 게시글 상세 </h2> <div class="container"> <form action="/insertProc" method="post"> <div class="form-group"> <label>제목</label> <p>${detail.subject}</p> </div> <div class="form-group"> <label>작성자</label> <p>${detail.writer}</p> </div> <div class="form-group"> <label>작성날짜</label> <p>${detail.reg_date}</p> </div> <div class="form-group"> <label>내용</label> <p>${detail.content}</p> </div> <button type="submit" class="btn btn-primary">작성</button> </form> </div> <%@ include file="bootstrap.jsp" %> </body> </html> | cs |
2. 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 | <%@ 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 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> <h2> 게시글 목록 </h2> <button class="btn btn-primary" onclick="location.href='/insert'">글쓰기</button> <div class="container"> <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>${l.reg_date}</td> </tr> </c:forEach> </table> </div> <%@ include file="bootstrap.jsp" %> </body> </html> | cs |
3. 프로젝트 재실행 후 http://localhost:8080/list 접속 - 리스트에서 해당 글 선택
4. 게시글 상세 끝
반응형
'SpringBoot 게시판 만들기' 카테고리의 다른 글
스프링부트(SpringBoot) 게시판 만들기9 - Multipart 파일 업로드 (7) | 2017.09.02 |
---|---|
스프링부트(SpringBoot) 게시판 만들기8 - 게시글 수정(update), 삭제(delete) (1) | 2017.08.20 |
스프링부트(SpringBoot) 게시판 만들기6 - 게시글 목록(list) + jstl 태그 사용 (2) | 2017.08.20 |
스프링부트(SpringBoot) 게시판 만들기5 - 게시글 쓰기(Insert) + 부트스트랩 끼얹기 (4) | 2017.08.20 |
스프링부트(SpringBoot) 게시판 만들기4 - CRUD (7) | 2017.08.20 |
댓글