Spring 기초 / 회원 조회 기능 구현 : thymeleaf 템플릿으로 객체리스트 속성꺼내기

권나영·2021년 11월 2일
0

Spring 기초

목록 보기
13/14

마찬가지로, GetMapping으로 findMembers 메서드로 찾은 회원 members 객체 리스트 다 memberList.html로 보내

thymeleaf 템플릿으로 꺼내

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<body>

<div class="container">
    <div>
        <table>
            <thead>
                <tr>
                    <th>#
                    </th>
                    <th>이름</th>
                </tr>
            </thead>
            <tbody>
            <tr th:each="member:${members}">
                <td th:text="${member.id}"></td>
                <td th:text="${member.name}"></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>

</body>
</html>

profile
나영

0개의 댓글

Powered by GraphCDN, the GraphQL CDN