Spring引导程序无法找到jsp视图 [英] Spring boot can not find jsp views
问题描述
我完成了基于Spring的 web应用程序,然后开始将其重建为 Spring引导,因为它使我能够使用嵌入式码头 。
此刻我遇到了一些问题 - Spring引导无法找到(解析)jsp视图。所以,当我运行我的应用程序 - 我在浏览器中得到错误:
这是
-
稍微修改您的pom.xml,例如低于
UPDATE:
IngeniousTom,
我无法在嵌入式 Jetty
,是我努力添加众多 Maven
Jetty $ c $后可以达到的最远点c> jar库,如下所示
< img src =https://i.stack.imgur.com/iB7hi.pngalt =在这里输入图片描述>
这是实际上是一个已知的问题,我不明白这是如何解决的,没有任何诡计。
如果您阅读 github
链接,Spring-Boot和Jetty阵营之间有许多讨论。
$ b 讨论的底线是 Spring-Boot
不支持 Jsp 嵌入
Jetty
作为他们的标准,但将来会有计划。
我的建议是不要使用 Jsp
或者使用 Jetty
作为您的嵌入式容器。
Helo everyone! I completed my Spring based web app and then started to rebuild it to Spring boot because it gives me ability to use embedded jetty. At the moment I got some problem - Spring boot can not find (resolve) jsp views. So when I run my app - I get the error in browser:
Here is my web app on github - so you can just look at files and find the reason.
Help me please!
P.S. Yes I used @ResourceImport because I don't know how to rewrite the existing spring configuration xml files to java-based config files but you may show me HOW to do that in your answer.
P.P.S. And for some reason the target directory does not contain WEB-INF and it's content folders after compiling. May be this is the reason but I don,t know how to solve it!
I checkout-ed your code from github
and managed to deploy into embedded Tomcat 8.0.3
and standalone Tomcat 8.0.x
.
I will just go through the steps for embedded Tomcat
instead of Jetty
(as I have not figured out the Jetty
configuration fully yet).
There are two things that you could do
- Copy your webapps into the following location without the s, e.g.
/dvdexchange-spring-boot/src/main/webapp
Modify slightly your pom.xml, e.g. below
The final outcome as below
-
UPDATE:
IngeniousTom,
I was not able to make it work in embedded Jetty
, the furthest point I could reach after struggling to add numerous Maven
Jetty
jar libraries as shown below
This is actually a known issue and I do not see how this can be solved without any hackish way.
If you read in the github
link, there is numerous discussion between Spring-Boot and Jetty camps.
The bottom line of the discussion is that Spring-Boot
does not support yet Jsp
in embedded Jetty
as their standard but have plans in future.
My recommendation is not to use Jsp
or use other than Jetty
as your embedded container.
这篇关于Spring引导程序无法找到jsp视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!