農農  

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.运行结果 

 

 

 

 

 

posted on 2019-12-12 15:33  Baekhyunne  阅读(447)  评论(0编辑  收藏  举报