springboot整合jsp

由于不想使用新模版,增加学习成本,故此延用jsp;

1、pom 文件

<!-- jsp -->
		<dependency>
			<groupId>org.apache.tomcat.embed</groupId>
			<artifactId>tomcat-embed-jasper</artifactId>
		</dependency>
		<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
		</dependency>
		<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
		</dependency>

  注意:pom 中要删除thymeleaf 引用。

2、配置文件

# peizhi
spring.mvc.view.prefix=/views/
spring.mvc.view.suffix=.jsp  

  注意了,手动添加:

否则,报404,搞了一天,不是原来的地方了,原来的是:

www.beicaiduo.com
原文地址:https://www.cnblogs.com/hoge66/p/8228245.html