Skip to content

Commit

Permalink
블록
Browse files Browse the repository at this point in the history
  • Loading branch information
kiteB committed Sep 21, 2021
1 parent d09fb61 commit f901beb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ public String comments(Model model) {
return "basic/comments";
}

@GetMapping("/block")
public String block(Model model) {
addUsers(model);
return "basic/block";
}

private void addUsers(Model model) {
List<User> list = new ArrayList<>();
list.add(new User("userA", 10));
Expand Down
18 changes: 18 additions & 0 deletions thymeleaf-basic/src/main/resources/templates/basic/block.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!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>

0 comments on commit f901beb

Please sign in to comment.