url link & literal
This commit is contained in:
@@ -64,6 +64,19 @@ public class BasicController {
|
||||
return "basic/date";
|
||||
}
|
||||
|
||||
@GetMapping("/link")
|
||||
public String link(Model model) {
|
||||
model.addAttribute("param1", "data1");
|
||||
model.addAttribute("param2", "data2");
|
||||
|
||||
return "basic/link";
|
||||
}
|
||||
|
||||
@GetMapping("/literal")
|
||||
public String literal(Model model) {
|
||||
model.addAttribute("data", "Spring!");
|
||||
return "basic/literal";
|
||||
}
|
||||
|
||||
@Component("helloBean")
|
||||
static class HelloBean {
|
||||
|
||||
16
thymeleaf/src/main/resources/templates/basic/link.html
Normal file
16
thymeleaf/src/main/resources/templates/basic/link.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>URL 링크</h1>
|
||||
<ul>
|
||||
<li><a th:href="@{/hello}">basic url</a></li>
|
||||
<li><a th:href="@{/hello(param1=${param1}, param2=${param2})}">hello query param</a></li>
|
||||
<li><a th:href="@{/hello/{param1}/{param2}(param1=${param1}, param2=${param2})}">path variable</a></li>
|
||||
<li><a th:href="@{/hello/{param1}(param1=${param1}, param2=${param2})}">path variable + query parameter</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
13
thymeleaf/src/main/resources/templates/basic/literal.html
Normal file
13
thymeleaf/src/main/resources/templates/basic/literal.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body> <h1>리터럴</h1>
|
||||
<ul>
|
||||
<li>'hello' + ' world!' = <span th:text="'hello' + ' world!'"></span></li> <li>'hello world!' = <span th:text="'hello world!'"></span></li>
|
||||
<li>'hello ' + ${data} = <span th:text="'hello ' + ${data}"></span></li> <li>리터럴 대체 |hello ${data}| = <span th:text="|hello ${data}|"></span></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user