1、页面是jsp时
pom.xml中的依赖
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<!--<scope>provided</scope>-->
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
application.properties中的配置
##Spring boot关于jsp页面的视图配置
spring.mvc.view.prefix=/WEB-INF/
spring.mvc.view.suffix=.jsp
2、页面是html时
pom.xml中的依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>2.0.7.RELEASE</version>
</dependency>
application.properties中不需要配置
页面跳转后台区分
1、页面跳转到后端java类,java只能返回要跳转的页面,用@Controller注解controller层,
2、页面通过ajax请求向后端java去请求数据,用@RestController进行controller层注解