第一步引入依赖
<dependencies>
<!--web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--jsp-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
</dependencies>
第二步webapp
第三步application.properties
spring.mvc.view.prefix=/
spring.mvc.view.suffix=.jsp
server.servlet.context-path=/uuu
server.port=8899
第四步 写jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" isELIgnored="false" %>
<html>
<head>
<title>测试</title>
</head>
<body>
<h1>${message}</h1>
</body>
</html>
第五步 写controller
@RestController
@RequestMapping("a")
public class UpController {
// @RequestMapping("a")
// public String up(){
// return "welcome";
// }
@RequestMapping("m")
public ModelAndView upl(){
ModelAndView mv= new ModelAndView();
mv.addObject("message","123123");
mv.setViewName("upload");
return mv;
}
}