1.通过IDE创建Spring Boot项目
2.目录结构
3.新建TestController控制器
@Controller
public class TestController {
@RequestMapping("/test")
public ModelAndView test(@RequestParam(name = "name", defaultValue = "刘德华") String name){
ModelAndView mv = new ModelAndView();
mv.addObject("name", name);
mv.setViewName("test");
return mv;
}
}
4.新建/resources/templates/test.ftlh模板文件
<html>
<body>
<h1>页面参数: ${name}</h1>
</body>
</html>