3-springboot项目使用jsp
1、在pom.xml文件中配置依赖项
<!--前端页面使用JSP-->
<!--引入Spring Boot内嵌的Tomcat对JSP的解析包-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<!--jstl标签依赖的jar包start -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!--jstl标签依赖的jar包end -->
2、在application.properties文件配置spring mvc的视图展示为jsp:
spring.mvc.view.prefix=/
spring.mvc.view.suffix=.jsp
3、在src/main 下创建一个webapp目录,然后在该目录下新建jsp页面
4、Maven的pom.xml中配置页面编译位置
<build>
<resources>
<resource>
<directory>src/main/webapp</directory>
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resource>
</resources>
springboot使用jsp报404错误的几种解决方案:
https://blog.51cto.com/liaozhiweiblog/5298075