스마트웹앱콘텐츠전문가/프레임워크
[thymeleaf]href 사용
9D4U
2020. 8. 7. 15:02
728x90
반응형
- 기본적인 사용
예시)
<a th:href="@{http://test.com}"> == <a href="http://test.com">
- 컨텍스트 경로 연관 URL 사용 : 컨텍스트 경로를 myproject로 가정
예시)
<a th:href="@{/test/index}"> == <a href="/myproject/test/index">
※ 파라미터 관련
[사용1]
예시)
<a th:href="@{/test/index(id=1,name='test')}" == <a href="/test/index?id=1&name=test">
[사용2]
예시)
<a th:href="@{/test/{id}/index(id=1,name='test')}"> == <a href="/test/1/index?name=test">
참조: www.thymeleaf.org/doc/articles/standardurlsyntax.html
Standard URL Syntax - Thymeleaf
The Thymeleaf standard dialects –called Standard and SpringStandard– offer a way to easily create URLs in your web applications so that they include any required URL preparation artifacts. This is done by means of the so-called link expressions, a type
www.thymeleaf.org
728x90