How can I set the prefix path(set the new directory) to render the HTML page?
I have a spring boot application. I am using version 2.1.7.
Thymeleaf in Spring Boot By default, HTML files should be placed in the resources/templates location.
Another way of accessing request parameters in thymeleaf is by using #httpServletRequest utility object which gives direct access to javax. servlet. http. HttpServletRequest object.
Add the following line in Application.properties
spring.thymeleaf.check-template-location=true
spring.thymeleaf.prefix=classpath:/templates/views/ #this is the main
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.cache=false
spring.main.allow-bean-definition-overriding=true
You can use basic setup or by overriding a property in application.properties to give your own customise page.
A prefix that gets prepended to view names when building a URL.
spring.thymeleaf.prefix=classpath:/config/templates/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With