简体   繁体   English

无法使用Spring Boot和MVC查找/渲染JSP文件

[英]Can't find / render JSP file with Spring Boot & MVC

I'm trying to build my first application with Spring in IntelliJ IDEA, however I can't make it find and/or render the JSP file called home.jsp. 我正在尝试在IntelliJ IDEA中使用Spring构建我的第一个应用程序,但是我无法使其找到和/或渲染名为home.jsp的JSP文件。 Please see the screenshots. 请查看屏幕截图。 Any help would be greatly appreciated. 任何帮助将不胜感激。 If you have any questions about my setup, pls leave a comment and I'll answer them. 如果您对我的设置有任何疑问,请发表评论,我会回答。

Here's my list of dependencies in Gradle 这是我在Gradle中的依赖项列表

dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.apache.tomcat.embed:tomcat-embed-jasper:8.0.30')
    runtime('org.hsqldb:hsqldb')
    testCompile('org.springframework.boot:spring-boot-starter-test') 
}

错误信息 截图

I put the JSP files under /webapp/WEB-INF/views/ and now it works. 我将JSP文件放在/ webapp / WEB-INF / views /下,现在可以使用了。 I think it has something to do with the webapp directory which wasn't automatically created by intellij. 我认为这与intellij不会自动创建的webapp目录有关。 Tomcat probably looks here for some files. Tomcat可能在这里查找一些文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM