加入tomcat和servlet的依赖:
<!-- servlet依赖 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- tomcat的支持-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
由于springboot默认的模板引擎是thymeleaf造成的
对比二者的结构
默认位置不同,需要在配置文件中添加配置jsp,并且关闭默认的配置
#jsp支持
mvc:
view:
prefix: /WEB-INF/jsp/
suffix: .jsp
#关闭默认模板引擎(thymeleaf),才会支持jsp
thymeleaf:
cache: false
enabled: false
就可以了