这个坑我踩了一个星期了,终于踩平了,来说一下注意事项,最后上代码
1.必不可少的jar包
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
2.jsp文件务必务必放到webapp/WEB-INF/下,没有文件夹就建文件夹
好,下面是源码:https://github.com/Genesisxu/SpringSeries/tree/master/SpringBoot-jsp