Reputation: 164
In the ThymeLeaf Tutorial for "Setting value for specific attributes", they both define the href
attribute and set it using th:href
.
<li><a href="product/list.html" th:href="@{/product/list}">Product List</a></li>
Is there a reason to include the href
tag since it will be set anyways? Are they setting these values in case if someone wants a static view of a page, i.e no renderer?
Upvotes: 0
Views: 62
Reputation: 106
if you question is how to add attr with href :
<li>
<a href="product/list.html" th:href="@{product/list(attrName=${attrValue})}">
Product List
</a>
</li>
if you question is how to redirect to static page :
// *** link to another page ***
<a th:href="@{staticPage}"> static page</a>
// *** Spring boot Controller ***
@RequestMapping(value="/staticPage", method=RequestMethod.GET)
public String staticPage(Model model) {
return "staticPage";
}
Upvotes: 1