-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
thymeleaf-basic/src/main/java/hello/thymeleaf/basic/BasicController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package hello.thymeleaf.basic; | ||
|
||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
@Controller | ||
@RequestMapping("/basic") | ||
public class BasicController { | ||
|
||
@GetMapping("/text-basic") | ||
public String textBasic(Model model) { | ||
model.addAttribute("data", "Hello Spring!"); | ||
return "basic/text-basic"; | ||
} | ||
|
||
@GetMapping("/text-unescaped") | ||
public String textUnescaped(Model model) { | ||
model.addAttribute("data", "Hello <b>Spring!</b>"); | ||
return "basic/text-unescaped"; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
thymeleaf-basic/src/main/resources/templates/basic/text-basic.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<h1>컨텐츠에 데이터 출력하기</h1> | ||
<ul> | ||
<li>th:text 사용 <span th:text="${data}"></span></li> | ||
<li>컨텐츠 안에서 직접 출력하기 = [[${data}]]</li> | ||
</ul> | ||
</body> | ||
</html> |
19 changes: 19 additions & 0 deletions
19
thymeleaf-basic/src/main/resources/templates/basic/text-unescaped.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<h1>text vs utext</h1> | ||
<ul> | ||
<li>th:text = <span th:text="${data}"></span></li> | ||
<li>th:utext = <span th:utext="${data}"></span></li> | ||
</ul> | ||
<h1><span th:inline="none">[[...]] vs [(...)]</span></h1> | ||
<ul> | ||
<li><span th:inline="none">[[...]] = </span>[[${data}]]</li> | ||
<li><span th:inline="none">[(...)] = </span>[(${data})]</li> | ||
</ul> | ||
</body> | ||
</html> |