Spring Framework

Spring) 회원 웹 기능 - 조회

na_o 2022. 2. 2. 20:28
728x90

https://github.com/NayoungBae/springIntroduction/commit/2a6c21918aaa055d46d7b4680540bdcdc28821ee

 

회원 웹 - 조회 · NayoungBae/springIntroduction@2a6c219

Permalink This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Browse files 회원 웹 - 조회 Loading branch information Showing 2 changed files with 34 additions and 0 deletions. +11 −0 src/

github.com

 

//경로 : templates/members/memberList.html 

...
            <tr th:each="member : ${members}">
                <td th:text="${member.id}"></td>
                <td th:text="${member.name}"></td>
            </tr>
...

Thymeleaf 문법

  • th:each
    • foreach랑 비슷한 반복문
    • ${members}는 model.addAttribute("members", members); 했던 그 데이터 리스트
  • th:text
    • 값을 출력해줌