thymeleaf模板引擎初步使用

#thymelea模板配置
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.cache=false
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**
@RequestMapping("/user")
@Controller
public class IndexController {
@RequestMapping("index")
public ModelAndView index(ModelAndView modelAndView){
modelAndView.setViewName("index");
modelAndView.addObject("name","XXX");
return modelAndView;
} @RequestMapping("home")
public String home(){
return "home";
} @RequestMapping("/map")
public String map(Map<String,String> map){
map.put("map","map");
return "map";
}
}
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1 th:text="${name}"></h1>
</body>
</html>

最新文章

  1. 多个radiobutton选定一个
  2. XproerIM-v1.3更新-企业即时通迅
  3. linux 7 常见命令
  4. 修改iptables防火墙规则解决vsftp登录后不显示文件目录的问题
  5. 在eclipse中生成html注释文档
  6. javascript遍历控件(实例详解)
  7. log4j定义某个类的日志级别
  8. iOS 之NSJSONReadingOptions说明【转】
  9. vue-cli的webpack模板项目配置文件分析
  10. Python-定时爬取指定城市天气(一)-发送给关心的微信好友
  11. DI是实现面向切面和面向抽象的前提
  12. tensorflow-mnist报错[WinError 10060] 由于连接方在一段时间后没有正确答复解决办法
  13. laravel整合vue 多入口解决
  14. Qt对象树
  15. java数组的for遍历
  16. Day08 - Ruby比一比:String的+=与concat串接
  17. Linux系统中Redis和Tomcat的PID文件路径设置
  18. java的抽象方法
  19. Linux用户相关指令
  20. 创建一个jdbc连接

热门文章

  1. 剑指Offer - 九度1348 - 数组中的逆序对
  2. 用JAX-WS在Tomcat中发布WebService
  3. 【转载】Unity3D研究院之IOS触摸屏手势控制镜头旋转与缩放
  4. 孤荷凌寒自学python第三十四天python的文件操作对file类的对象学习
  5. Where can I find the IPA logs
  6. Python 黑魔法(持续收录)
  7. shell之基本语法
  8. JavaScript里面的条件、循环语句以及异常处理
  9. Vue.js特性
  10. hdu 2821 Pusher (dfs)