Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@GetMapping("/{idx}")
public String read(@PathVariable Long idx, Model model) {
    model.addAttribute("board", boardService.findBoardByIdx(idx));
    return "item";
}

// View

<div class="container">
    <div class="page-header">
        <h1>게시글 확인</h1>
    </div>

    <table class="table">
        <tr>
            <th style="padding:13px 0 0 15px">게시판 종류</th>
            <td th:text="${board.boardType.name() == 'notice'} ? '공지사항' : '자유게시판'"></td>
        </tr>
        <tr>
            <th style="padding:13px 0 0 15px;">생성날짜</th>
            <td th:text="${board.createdDate} ? ${#temporals.format(board.createdDate,'yyyy-MM-dd HH:mm')} : ${board?.createdDate}"></td>
        </tr>
        <tr>
            <th style="padding:13px 0 0 15px;">제목</th>
            <td th:text="${board.title}"></td>
        </tr>
        <tr>
            <th style="padding:13px 0 0 15px;">부제목</th>
            <td th:text="${board?.subTitle}"></td>
        </tr>
        <tr>
            <th style="padding:13px 0 0 15px;">내용</th>
            <td th:text="${board.content}"></td>
        </tr>
    </table>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment