Monday, February 2, 2015

Use JSP and Thymeleaf in Spring Boot

You can find a sample using JSP and Thymeleaf in Spring Boot in the following link:

https://github.com/izeye/samples-spring-boot-branches/tree/jsp-and-thymeleaf

application.properties has the following properties:

spring.view.prefix: /WEB-INF/jsp/
spring.view.suffix: .jsp

spring.thymeleaf.cache=false
spring.thymeleaf.excluded-view-names=welcome

If you want to use some JSP views,

you should specify the view names to the 'spring.thymeleaf.excluded-view-names' property.

If not,

there's no chance to render them.

You'll get a 500 error indicating that there's no Thymeleaf template for the view name.

I can't understand why ThymeleafViewResolver returns a view

even when it doesn't have any template for the view name.

It prevents JSP from rendering it.

If it could return null instead of an invalid view,

the 'spring.thymeleaf.excluded-view-names' property would not be necessary.

Any idea?

Reference:
http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

No comments:

Post a Comment