Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 자바
- 스프링
- Proxy
- 알고리즘
- pointcut
- AOP
- db
- QueryDSL
- springdatajpa
- http
- Greedy
- 스프링 핵심 기능
- Android
- JPQL
- 김영한
- kotlin
- Servlet
- 인프런
- Spring Boot
- spring
- 그리디
- Thymeleaf
- 스프링 핵심 원리
- jpa
- JDBC
- SpringBoot
- 백준
- Exception
- transaction
- java
Archives
- Today
- Total
개발자되기 프로젝트
[Thymeleaf] block, <ht:block> 본문
1. <ht:block>
- Thymeleaf자체 태그
- 예를 들어 <div></div>를 여러 개 묶어서 루프 돌리고 싶을 때 사용하면 좋음.
- 해당 tag를 사용해서 여거 div을 하나의 block으로 묶을 수 있음.
2. controller
@GetMapping("/block")
public String block(Model model){
addUsers(model);
return "basic/block";
}
3. block.html
<!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>
4. GitHub : 210919 Block
GitHub - bsh6463/Thymeleaf
Contribute to bsh6463/Thymeleaf development by creating an account on GitHub.
github.com
'인프런 > [인프런] 스프링 MVC 2' 카테고리의 다른 글
[Thymeleaf] 템플릿 조각 (0) | 2021.09.19 |
---|---|
[Thymeleaf] JavaScript inline (0) | 2021.09.19 |
[Thymeleaf] 주석 (0) | 2021.09.19 |
[Thymeleaf] 조건 부 평가, if, unless, switch, case (0) | 2021.09.19 |
[Thymeleaf] 반복, each (0) | 2021.09.18 |
Comments