thymeleaf (intelliJ) 맛보기

ayleen·2022년 1월 20일
0




Thymeleaf란?

thymeleaf는 View Template Engine이다.
컨트롤러에서 전달받은 데이터를 이용해 동적인 페이지를 만들 수 있다.
태그의 속성으로 thymeleaf 명령어를 사용할 수 있으며 html파일 내에서 사용이 가능하다.




Thymeleaf Dependency

Maven(pom.xml)

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

Gradle(build.gradle)

dependencies {
...
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	}

▶ 나는 프로젝트를 생성할때 선택해서 따로 추가하지 않았다.




실습


VO


Mapper


interface


controller


Html


th:each 속성을 활용하면 반복하여 처리할 수 있다.
th:text는 태그 안의 텍스트를 전달 받은 값으로 출력한다.


결과물

profile
asdf

2개의 댓글

comment-user-thumbnail
2022년 1월 21일

혹시 여기서 "getDapdata3 ===> id->{}///name->{}", data.getDepartmentId(), data.getDepartmentName()
"getDapdata3 ===> id->{}///name->{}" 이런 표현 방식을 뭐라고 하시는지 아시나요?
이것도 Thymeleaf인가요??

1개의 답글