🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (178K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
In this article, we will discuss JSP vs Thymeleaf support in Spring Boot and which one is better to use with Spring boot.
I have used JSP and Thymeleaf with Spring boot to develop a Spring MVC web application. I am going to suggest to you which one has good support either JSP or Thymeleaf to work with Spring boot.
JSP vs Thymeleaf Support in Spring Boot
Spring MVC supports a variety of templating technologies, including Thymeleaf, FreeMarker, and JSPs. Also, many other templating engines include their own Spring MVC integrations.
Spring Boot includes auto-configuration support for the following templating engines:For example, when you add thymeleaf engine starter dependency to spring boot project in pom.xml:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
Spring boot will automatically configure all the beans for thymeleaf to integrate with Spring boot project such as ViewResolver etc.
Read this Spring boot Thymeleaf tutorial at Spring Boot Thymeleaf Example Tutorial.
When you use one of these templating engines with the default configuration, your templates are picked up automatically from src/main/resources/templates.
Now, let's discuss about JSP support in the Spring boot project.
From Spring boot official documentation:
If possible, JSPs should be avoided. There are several known limitations when using them with embedded servlet containers.Spring boot official documentation says that JSP's should be avoided because it has some known limitations with embedded servlet containers (Tomcat, jetty, undertow etc).
JSP Limitations
When running a Spring Boot application that uses an embedded servlet container (and is packaged as an executable archive), there are some limitations in the JSP support.
- With Jetty and Tomcat, it should work if you use war packaging. An executable war will work when launched with java -jar, and will also be deployable to any standard container. JSPs are not supported when using an executable jar.
- Undertow does not support JSPs.
- Creating a custom error.jsp page does not override the default view for error handling. Custom error pages should be used instead.
Conclusion
References
My Top and Bestseller Udemy Courses. The sale is going on with a 70 - 80% discount. The discount coupon has been added to each course below:
Build REST APIs with Spring Boot 4, Spring Security 7, and JWT
[NEW] Learn Apache Maven with IntelliJ IDEA and Java 25
ChatGPT + Generative AI + Prompt Engineering for Beginners
Spring 7 and Spring Boot 4 for Beginners (Includes 8 Projects)
Available in Udemy for Business
Building Real-Time REST APIs with Spring Boot - Blog App
Available in Udemy for Business
Building Microservices with Spring Boot and Spring Cloud
Available in Udemy for Business
Java Full-Stack Developer Course with Spring Boot and React JS
Available in Udemy for Business
Build 5 Spring Boot Projects with Java: Line-by-Line Coding
Testing Spring Boot Application with JUnit and Mockito
Available in Udemy for Business
Spring Boot Thymeleaf Real-Time Web Application - Blog App
Available in Udemy for Business
Master Spring Data JPA with Hibernate
Available in Udemy for Business
Spring Boot + Apache Kafka Course - The Practical Guide
Available in Udemy for Business

Comments
Post a Comment
Leave Comment