今天很郁闷,伟大的Spring框架不想学那几个高级的View Engine 就想用JSP吧,结果一天了,一个HelloWord也没有整出来,来看看官方是怎么说的?
原文地址:https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#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 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.
JSP限制
当运行Spring Boot应用使用内嵌从Servlet容器(打包为一个可执行的archive),在对JSP的支持上有一些限制。
用Jetty和Tomcat,你应该用war来打包。一个可执行的war将用命令 java - jar来启动,并且会被部署到任何标准的容器。当使用jar的时候JSP不被支持。
Undertow 不支持JSP。
创建error.jsp 不覆盖默认的用于error 处理的view,定制化的error page该被使用。