首页  

springboot中为什么不推荐使用jsp     所属分类 spring 浏览量 1386
If possible, JSPs should be avoided. There are several known limitations when using them with embedded servlet containers.

尽可能避免使用jsp
嵌入式servlet容器使用jsp有一些限制

https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/html/boot-features-developing-web-applications.html#boot-features-jsp-limitations

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 Tomcat, it should work if you use war packaging. 
That is, an executable war works and is also deployable to a standard container (not limited to, but including Tomcat). 
An executable jar does not work because of a hard-coded file pattern in Tomcat.

With Jetty, it should work if you use war packaging. 
That is, an executable war works, and is also deployable to any standard container.

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.

打成war包, 部署到标准容器可以正常工作

Undertow不支持 jsp

创建自定义error.jsp页面不会覆盖用于错误处理的默认视图。应该使用自定义错误页面。

https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-samples/spring-boot-sample-web-jsp

上一篇     下一篇
漫步华尔街经典语录

《华尔街:金钱永不眠》经典台词

maven内置属性

Maven Dependencies 与 Referenced Libraries的区别

springboot2获取HttpServletRequest的三种方式

21 Questions for a Trading Plan