프로그래밍/thymeleaf

타임리프(thymeleaf)

Baesj 2021. 9. 3. 16:57

타임리프(thymeleaf)를 사용하기 위해서는

 

1. dependencies에 implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' 를 추가해 줘야한다.

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	compileOnly 'org.projectlombok:lombok'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

 

2. html 파일에 <html xmlns:th="http://www.thymeleaf.org">를 추가해 줘야 한다.

<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
</head>