SpringBoot跳转templats文件夹下的页面
1. 引入thymleaf依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
springBoot中不要引
hymeleaf
2. controller返回String类型
@RequestMapping("/ss1")
public String login1() {
return "hello";
}
3. 返回MondelAndView
@RequestMapping("/hi")
public ModelAndView login() {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName( "hello" );
return modelAndView;
}