최신버전은 클라이드 기반이라 로컬저장소 지원이 미흡함
Deploy(배포)는 보통 war파일로 함
com.code.bootexample.thymeleafexample.controller
DemoController.java
package com.code.bootexample.thymeleafexample.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class DemoController {
@GetMapping("/hello")
public String sayHello(Model theModel) {
theModel.addAttribute("theDate", new java.util.Date());
return "helloworld";
}
}
src/main/resources/templates
helloworld.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Thymeleaf Example</title>
</head>
<body>
Time on Server(p) : <p th:text="${theDate}"></p>
<p th:text = "'Time on Server:::' + ${theDate}"/>
Time on Server(span) : <span th:text="${theDate}"></span>
</body>
</html>
src/main/resources
application.properties
server.port = 1114
src/main/resources
static/css 폴더
css파일 작성
.funny{
font-style: italic;
color: green;
}
link 추가
<link rel="stylesheet" th:href = "@{/css/demo.css}"/>