티스토리 뷰

공부/Java, JSP

[Thymeleaf] Url with pathvariable

doublemetal 2015. 8. 11. 11:05

thymeleaf 가이드 문서의 

Standard URL Syntax

을 살펴보면...


아래 {id}와 같은 구문을 사용할 수 있다고 나와 있다.

<a th:href="@{/order/{id}/details(id=3,action='show_all')}">


하지만. 실제로 사용해보면.. 안되는 문제가 있는데..



thymeleaf github에서는 


<a th:href="@{'/order/details/' + ${id} + '/' + ${action}}"

이런 명확한 방법이 있는데 왜 안쓰냐.. 대충 이런 이야기인 것 같고(말이 많아서 보다 말았음..)



sof에서 아래 2가지 발견

http://stackoverflow.com/questions/14938344/thymeleaf-construct-url-with-variable

http://stackoverflow.com/questions/22059314/thymeleaf-spring-mvc-how-do-you-nest-variables-expressions-in-a-link-expressio



1. __...__ expression preprocessing  <form th:action="@{/mycontroller/__${type}__}">

2. |...| pipeline syntax (|)  <link th:href="@{|/resources/libs/css/${view_name}.css|}" rel="stylesheet" />




1번 방법으로 적용!

'공부 > Java, JSP' 카테고리의 다른 글

log4j  (0) 2016.05.18
[멀티채팅] 뮤뮤챗 소스를 찾았는데...  (0) 2015.08.26
client IP 가져오기  (0) 2015.07.27
Xstream :: List in Object  (0) 2015.06.04
xml parsing - Document, XPath  (0) 2015.05.20
댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함