본문 바로가기

thymeleaf

타임리프 div 여러개 묶어서 반복

 

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<th:block th:each="user : ${users}">
    <div>
        사용자 이름1 <span th:text="${user.username}"></span>
        사용자 나이1 <span th:text="${user.age}"></span>
    </div>
    <div>
        요약 <span th:text="${user.username} + ' / ' + ${user.age}"></span>
    </div>
</th:block>
</body>
</html>

신기한점:<th:block></th:block> 태그 내부만 랜더링되고 <th:block>태그는 랜더링 안됨

'thymeleaf' 카테고리의 다른 글

타임리프와 자바스크립트  (0) 2022.06.27
타임리프 div 여러개 묶어서 반복  (0) 2022.06.27
타임리프 조건문  (0) 2022.06.27
타임리프 반복문  (0) 2022.06.27
타임리프 데이터 없을 때  (0) 2022.06.27