使用SpringBoot访问jsp页面

1 编写application.yml文件 

spring:
  mvc:
    view:
      suffix: .jsp
      prefix: /jsp/

2 创建Controller层

@Controller
@RequestMapping("/jspfirst")
public class JSPRequestController {
    @RequestMapping("/jspRequest")
    public String jspRequest(Model model){
        model.addAttribute("name","lis");
        System.out.println("进入controller");
        return "index";
    }

}

3 编写 jsp页面

<body>

${name}

</body>

4 运行程序 

@SpringBootApplication
public class StartSpringBoot {
    public static void main(String[] args) {
        SpringApplication.run(StartSpringBoot.class,args);
    }
}

5.运行结果 

原文地址:https://www.cnblogs.com/szhhhh/p/12029517.html