
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello</title>
</head>
<body>
hello
<a href="/hello">hello</a>
</body>
</html>


thymeleaf : https://www.thymeleaf.org/
package hello.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HelloController {
//MVC 방식
// WebApplication에서 /hello로 접근을 하면 아래에 밑에 메소드를 호출
// Get은 get, post 방식 중 get 방식으로 url로 접근했을 때 호출
@GetMapping("hello")
public String hello(Model model) {
// key,value로 설정
model.addAttribute("data","spring!!");
// template 중 hello라는 이름을 가진 template에 전달, 여기서는 hello.html
// resources:templates/ +{ViewName}+ .html, viewname은 return 값
return "hello";
}
}

<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org"> <!-- thymleaf template 엔진-->
<head>
<title>Hello</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<!-- th : thymleaf의 약자, ${} : el의 추가된 문법으로 <%=%>과 동일하다. data는 contoller의 HelloController에 입력한 데이터이다-->
<p th:text="'안녕하세요. ' + ${data}" >안녕하세요. 손님</p>
</body>
</html>



인텔리J 컴파일 방법: 메뉴 build Recompile