November 18, 2024

<tbody>
            <tr th:each="post : ${postList}">
                <td>
                    <a th:href="@{|/post/detail/${post.id}|}" th:text="${post.title}"></a>
                </td>
                <td th:text="${post.createDate}"></td>
            </tr>
        </tbody>
@Controller
@RequestMapping("/post") //URL 프리픽스
class PostController(

답변 기능

<form th:action="@{|/comment/create/${post.id}|}" method="post">
    <textarea name="content" id="content" rows="15"></textarea>
    <input type="submit" value="답변등록">
</form>

November 19, 2024

부트스트랩 적용

  1. bootstrap-5.3.1-dist.zip 다운로드
  2. resource/static 에 bootstrap.min.css 복사

post_list.html에 부트스트랩 적용

<link rel="stylesheet" type="text/css" th:href="@{/bootstrap.min.css}">
<div class="container my-3">
<head>
    <meta charset="UTF-8">
    <title>Kchabin's Blog</title>
</head>
    <h2>블로그 게시물</h2>
    <table class="table">
        <thead class="table-dark">
            <tr>
                <th>번호</th>
                <th>제목</th>
                <th>작성일시</th>
            </tr>
        </thead>
        <tbody>
            <tr th:each="post, loop : ${postList}">
                <td th:text="${loop.count}"></td>
                <td>
                    <a th:href="@{|/post/detail/${post.id}|}" th:text="${post.title}"></a>
                </td>
                <td th:text="${#temporals.format(post.createDate, 'yyyy-MM-dd HH:mm')}"></td>
            </tr>
        </tbody>
    </table>
</div>

스크린샷 2024-11-19 오전 9.06.13.png