Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
453 views
in Technique[技术] by (71.8m points)

java - Spring boot can not find jsp views

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:

error

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!

target

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

  1. Copy your webapps into the following location without the s, e.g. /dvdexchange-spring-boot/src/main/webapp

enter image description here

  1. Modify slightly your pom.xml, e.g. below enter image description here

  2. The final outcome as below enter image description here

-

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

enter image description here

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...