Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access contextPath in Thymeleaf?

I wanted to access contextPath in thymeleaf without setting org.springframework.ui.Model. I configured context path in application.properties file

like image 209
Jackson Baby Avatar asked Dec 04 '22 22:12

Jackson Baby


1 Answers

If you are using Thymeleaf, you should be able to use

<a th:href="@{/XXX}">Link Name</a> 

assuming that has been declared.

I think this does require using SpringTemplateEngine.

like image 63
Ashish Kumar Saxena Avatar answered Feb 15 '23 01:02

Ashish Kumar Saxena