目录
![](https://img2018.cnblogs.com/i-beta/1509261/201912/1509261-20191212160849961-861521220.png)
依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
JspRequestController
@Controller
@RequestMapping("/jspRequestController")
public class JspRequestController {
@RequestMapping("/jspRequest")
public String jspRequest(Model model){
System.out.println("进入到控制器,准备转发页面");
model.addAttribute("name","丽丽");
return "index";
}
}
StarSpringBoot
@SpringBootApplication
public class StarSpringBoot {
public static void main(String[] args) {
SpringApplication.run(StarSpringBoot.class,args);
}
}
application.yml
##配置页面前缀后缀
spring:
mvc:
view:
suffix: .jsp
prefix: /jsp/
index.jsp
<%@page contentType="text/html;charset=UTF-8" language="java" %>
<head>
<title>SpringBoot如何集成JSP</title>
</head>
<body>
欢迎:${name}
</body>
</html>