Java Spring MVC template Engine

Which template engine is in Spring, which is similar to Blade in laravel?

I am new to Spring, I was looking for templates for engines, but I only found Jtwig, although it seems that this is more a set of functions.

I need to, like a click, create templates with a header, content, footer, include other views, etc. Thanks

+7
java spring spring-mvc jtwig
source share
4 answers

Try Thymeleaf . It is assumed that it will be the successor to the JSP (now considered obsolete).

See this tutorial on how to integrate it with Spring. Even the Spring team supports Thymeleaf .

To see a Thymleaf layout in action, see page .


Sneak peek

main.html

 ... <div th:replace="fragments/footer :: footer"> footer placeholder text to be replaced </div> 

<strong> fragments /footer.html

 <!DOCTYPE html> <html> <head> ... </head> <body> <div th:fragment="footer"> actual footer text </div> </body> </html> 
+7
source share

There are several java templates that work well with spring: speed, freemarker, thyme.

If it were me, I would consider a trim. This is a java mustache implementation that uses {{}} syntax for variables and does not allow client-side logic (this may be good).

This has become a very popular style of templates and may give you the opportunity to share the same client and server templates when creating modern single-page web applications.

+3
source share

You can try Apache Tiles . This is a template structure. Tiles were originally created to simplify the development of user interfaces for web applications, it has a seamless integration with Spring. Tiles allow authors to identify fragments of a page that can be assembled into a full page at run time.

Spring Tile Integration

+3
source share

For me, the equivalent of Thymeleaf ...

You can integrate angular.js, angular, react.js etc. if you want to implement a single page web application

0
source share

All Articles