■ Absolute URL (절대 경로)
- 특정 url로 직접 이동이 가능
<a th:href="@{http://www.thymeleaf/documentation.html}"> |
■ Context-relative URL
- 우리 서버 내 특정 위치로 이동이 가능
- 서버 내 리소스 /order/list
<a th:href="@{/oreder/list}"> |
■ Adding Parameter URL
https://www.test.io/order/details?id=1
<a th:href="@{/oreder/details(id=1)}"> |
파라미터를 여러개 사용하기 위해서는 아래와 같이 쉼표로 구분합니다.
<a th:href="@{/oreder/details(id=1, action='show_all')}"> |
■ Server-relative URL
Server-relative URLs are very similar to context-relative URLs, except they do not assume you want your URL to be linking to a resource inside your application’s context, and therefore allow you to link to a different context in the same server:
<a th:href="@{~/billing-app/showDetails.htm}">
The current application’s context will be ignored, therefore although our application is deployed at http://localhost:8080/myapp, this URL will output:
<a href="/billing-app/showDetails.htm">
Protocol-relative URLs
Protocol-relative URLs are in fact absolute URLs which will keep the protocol (HTTP, HTTPS) being used for displaying the current page. They are typically used for including external resources like styles, scripts, etc.:
<script th:src="@{//scriptserver.example.net/myscript.js}">...</script>
…which will render unmodified (except for URL rewriting), like:
<script src="//scriptserver.example.net/myscript.js">...</script>
https://www.thymeleaf.org/doc/articles/standardurlsyntax.html
'JSP & ThymeLeaf' 카테고리의 다른 글
로또 (Jquery 버전) (0) | 2024.03.26 |
---|---|
Jsp/Servlet Scope( 영역) - 메모리 그림 (0) | 2022.06.17 |
POJO란? (0) | 2022.02.09 |
mvc_board - 게시판 테이블 생성 (0) | 2022.02.02 |
JSP - 로또 번호 (번호대별 색깔, 번호 카운트 증가 기능 추가) (0) | 2021.12.05 |