본문 바로가기
Spring

[SpringBoot/IntelliJ] Thymeleaf URL표현(th:href)

by noddu 2022. 4. 14.
728x90
반응형

Absolute URL

 

<a th:href="@{http://www.thymeleaf/documentation.html}">

작성한 url로 직접 이동

 


 

 Context-relative URL

<a th:href="@{'/mainProductBoard/Detail'}" >

resources / mainProductBoard / Detail 호출

 

<a th:href="@{'/mainProductBoard/Detail' + ${mainproduct.mainProductId}}" >

특정 값도 추가할 수 있다

 


Adding Parameter URL

<a th:href="@{/mainProductBoard/Detail(id=1)}">

http://localhost:8082/mainProductBoard/Details?id=1

이런식으로 파라미터를 만드는 것이다

 

<a th:href="@{/mainProductBoard/Detail(id=${productId})}">

이런식으로 위처럼 서버값을 이용하여 만들 수 있다

반응형