> For the complete documentation index, see [llms.txt](https://heunnajo.gitbook.io/spring/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://heunnajo.gitbook.io/spring/thymeleaf.md).

# Thymeleaf 템플릿 엔진으로 동적 페이지 생성하기

index.html은 단순히 정적인 웹문서에 불과하지만 템플릿 엔진을 사용함으로써 동적으로(반복문/...) 동작하게 만들 수 있다!

컨트롤러에서 html로 데이터를 넘겨주고, html에서 data를 받아 출력(렌더링)할 수 있다.

![](https://3827409906-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdFkJ5hOZX5yyMKQHqf%2F-MdG08JBuKcgnmR5R37o%2F-MdG0EdPDggiYsed1Mma%2F%E1%84%8F%E1%85%A5%E1%86%AB%E1%84%90%E1%85%B3%E1%84%85%E1%85%A9%E1%86%AF%E1%84%85%E1%85%A5%E1%84%8B%E1%85%A6%E1%84%89%E1%85%A5%20%E1%84%82%E1%85%A5%E1%86%B7%E1%84%80%E1%85%B5%E1%84%82%E1%85%B3%E1%86%AB%20%E1%84%83%E1%85%A6%E1%84%8B%E1%85%B5%E1%84%90%E1%85%A5%E1%84%80%E1%85%A1%E1%86%B9%20%E1%84%87%E1%85%A7%E1%86%AB%E1%84%80%E1%85%A7%E1%86%BC%E1%84%89%E1%85%B5%20hello.html%E1%84%8B%E1%85%A6%E1%84%89%E1%85%A5%E1%84%83%E1%85%A9%20%E1%84%8B%E1%85%B5%E1%84%8B%E1%85%A6%20%E1%84%84%E1%85%A1%E1%84%85%E1%85%A1%20%E1%84%87%E1%85%A7%E1%86%AB%E1%84%80%E1%85%A7%E1%86%BC%E1%84%83%E1%85%AC%E1%86%B7.png?alt=media\&token=12f619b2-8d3c-45e1-939c-fc2205de66d5)

사진에서 보는 것처럼 컨트롤러에서 리턴하는 "hello"는 템플릿 하위에 "hello.html"을 찾아서 렌더링하도록 한다! 이때 "data"라는 이름으로 (흔나 화이팅!!!)을 넣어주먼 hello.html에서 data는 받은 값을 포함시켜 렌더링하는 것을 확인할 수 있다!

@GetMapping("hello") : hello라는 페이지가 접속해오 스프링에서 Model을 만들어서 넣어준다.
