operation
This commit is contained in:
@@ -78,6 +78,13 @@ public class BasicController {
|
||||
return "basic/literal";
|
||||
}
|
||||
|
||||
@GetMapping("/operation")
|
||||
public String operation(Model model) {
|
||||
model.addAttribute("nullData", null);
|
||||
model.addAttribute("data", "Spring!");
|
||||
return "basic/operation";
|
||||
}
|
||||
|
||||
@Component("helloBean")
|
||||
static class HelloBean {
|
||||
public String hello(String data) {
|
||||
|
||||
45
thymeleaf/src/main/resources/templates/basic/operation.html
Normal file
45
thymeleaf/src/main/resources/templates/basic/operation.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li>산술 연산
|
||||
<ul>
|
||||
<li>10 + 2 = <span th:text="10 + 2"></span></li>
|
||||
<li>10 % 2 == 0 = <span th:text="10 % 2 == 0"></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>비교 연산
|
||||
<ul>
|
||||
<li>1 > 10 = <span th:text="1 > 10"></span></li>
|
||||
<li>1 gt 10 = <span th:text="1 gt 10"></span></li>
|
||||
<li>1 >= 10 = <span th:text="1 >= 10"></span></li>
|
||||
<li>1 ge 10 = <span th:text="1 ge 10"></span></li>
|
||||
<li>1 == 10 = <span th:text="1 == 10"></span></li>
|
||||
<li>1 != 10 = <span th:text="1 != 10"></span></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
<li>조건식
|
||||
<ul>
|
||||
<li>(10 % 2 == 0)? '짝수':'홀수' = <span th:text="(10 % 2 == 0)? '짝수':'홀수'"></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Elvis 연산자
|
||||
<ul>
|
||||
<li>${data}?: '데이터가 없습니다.' = <span th:text="${data}?: '데이터가 없습니다.'"></span></li>
|
||||
<li>${nullData}?: '데이터가 없습니다.' = <span th:text="${nullData}?: '데이터가 없습니다.'"></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>No-Operation
|
||||
<ul>
|
||||
<li>${data}?: _ = <span th:text="${data}?: _">데이터가 없습니다.</span></li>
|
||||
<li>${nullData}?: _ = <span th:text="${nullData}?: _">데이터가 없습니다.</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user