본문 바로가기
개발/Spring

[SpringBoot+IntelliJ+Oracle+Thymeleaf+Paging] 웹 게시판 만들기(7) - html 화면

by 코딩하는 흰둥이 2023. 4. 20.

이전글

https://greed-yb.tistory.com/214

 

[SpringBoot+IntelliJ+Oracle+Thymeleaf+Paging] 웹 게시판 만들기(5) - UTIL (Paging)

이전글 https://greed-yb.tistory.com/213 [SpringBoot+IntelliJ+Oracle+Thymeleaf+Paging] 웹 게시판 만들기(5) - Vo 이전글 https://greed-yb.tistory.com/212 [SpringBoot+IntelliJ+Oracle+Thymeleaf+Paging] 웹 게시판 만들기(4) - Mapper , DB 생

greed-yb.tistory.com

 

 

index.html ( 게시판 리스트)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Board</title>
</head>
<body>
<h1 style="text-align: center">게시판</h1>
<div>
    <form th:action="@{/}" method="get">
        <select name="searchType">
            <option value="title">제목</option>
            <option value="name">이름</option>
            <option value="content">내용</option>
        </select>
        <input type="text" name="keyword">
        <button type="submit">검색</button>
    </form>

    <button type="button" style="float:right" th:onclick="|location.href='@{/board/create}'|">글 작성</button>
</div>
<div>
    <table border="2px" style="width: 100%">
        <thead>
        <tr>
            <th>번호</th>
            <th>제목</th>
            <th>이름</th>
            <th>날짜</th>
        </tr>
        </thead>
        <tbody>
        <tr th:if="${#lists.isEmpty(vo)}">
            <td colspan="4" style="text-align: center">작성된 글이 없습니다.</td>
        </tr>
        <tr th:each="vo : ${vo}">
            <td th:text="${vo.b_num}"></td>
            <td><a th:text="${vo.b_title}" th:href="@{/board/read(num=${vo.b_num})}"></a></td>
            <td th:text="${vo.b_name}"></td>
            <td th:text="${vo.b_date}"></td>
        </tr>
        </tbody>
    </table>
</div>
<!--paginate -->
<div class="box-footer clearfix">
    <ul class="pagination pagination-sm no-margin pull-right">

        <li th:if="${pm.prev} == true">
            <a th:href="@{/(page=${pm.startPage}-1,perPageNum=${pm.cri.perPageNum})}">&laquo;</a>
        </li>

        <li th:if="${pm.totalCount != 0}" th:each="idx,iterStat : ${#numbers.sequence(pm.startPage,pm.endPage)}">
            <a th:href="@{/(page=${idx},perPageNum=${pm.cri.perPageNum})}" th:text="${idx}"></a>
        </li>

        <li th:if="${pm.next} == true and ${pm.endPage > 0}">
            <a th:href="@{/(page=${pm.endPage}+1,perPageNum=${pm.cri.perPageNum})}">&raquo;</a>
        </li>

    </ul>
</div>
<!-- /paginate -->
</body>
</html>

 

 

BoardCreate.html ( 게시글 생성)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Board_Create</title>
</head>
<body>
글 작성 페이지
<div>
    <form name="form" method="post" action="/board/create">
        이름 : <input name="b_name"></p>
        제목 : <input name="b_title"></p>
        내용 : <textarea name="b_content" rows="30" cols="50"></textarea>
        <div>
            <button type="submit">버튼</button>
        </div>
    </form>
</div>

</body>
</html>

 

 

BoardRead.html ( 게시글 상세 페이지)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Board_Create</title>
</head>
<body>
글 상세 페이지
<div>
    <form name="form" method="post" action="/board/update">
        <input type="hidden" name="b_num" th:value="${vo.b_num}">
        이름 : <input name="b_name" th:value="${vo.b_name}" readonly></p>
        제목 : <input name="b_title" th:value="${vo.b_title}" ></p>
        내용 : <textarea name="b_content" rows="30" cols="50" th:text="${vo.b_content}"></textarea>
        <div>
            <button type="submit">수정하기</button>
            <button type="button" th:onclick="|location.href='@{/board/delete(num=${vo.b_num})}'|">삭제하기</button>
        </div>
    </form>
</div>

</body>
</html>

댓글