近日在部署项目时遇到了这个问题,网上搜寻答案一致未得到解决,知道偶然看到这边博客,才解决了我遇到的问题。
参考idea springboot 其他功能正常但是无法访问jsp_springboot访问不到jsp文件-优快云博客
问题描述:相关配置均正确无误,就是一直无法访问jsp文件
解决步骤:
1、打开目录结构,将webapp标记为Resources
2、选择项目web进行设置
3、设置pom.xml,因为springboot不支持jsp,所以要导入对应的依赖,以及设置web资源
<!--用于编译jsp-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<build>
<resources>
<resource>
<directory>src/main/webapp</directory>
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
</build>
4、重新编译,生成对应的classes即可
5、我这里遇到编码问题,设置吓idea的编码格式即可