Add jsp file dependencies
<!-- 对jsp的支持的依赖 --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <scope>provided</scope> </dependency> <!-- jsp页面使用jstl标签 --> <dependency> <groupId>javax.servlet</groupId> <artifactId>JSTL</artifactId> </dependency> <!-- 用于编译jsp --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <scope>provided</scope> </dependency> <!-- Provided 编译和测试的时候使用--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
Add webapp / WEB-INF / jsp directory
The new webapp is just an ordinary folder, right in the jsp new folder, select the template jsp no need to configure
Configuration View prefixes and suffixes in application.properties file, meaning and SpringMVC in the same folder can not call jsp, can be called by SpringMVC habit pages, depending on the file name of the folder created above you
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
Add control layer test method
index.jsp page
Run using maven command