springboot+Thymeleaf demo 每天进步百分之一
来源:互联网 发布:小说淘宝网免费阅读 编辑:程序博客网 时间:2024/05/29 02:48
1.导入架包
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf </artifactId></dependency>
2.配置Thymeleaf
thymeleaf: cache: false prefix: classpath:/templates/ suffix: .html encoding: UTF-8 content-type: text/html mode: HTML5
3.写个测试的controller
@Controllerpublic class ThymeleafTestController { @GetMapping("/hello") public String helloHtml(ModelMap map){ map.put("hello","thyeleaf测试"); return "/index"; }}
4.写个测试的页面
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"><head> <title>Hello World!</title></head><body> <h1 th:inline="text">Hello</h1> <p th:text="${hello}"></p></body></html>
注:测试页面的文件名必须与controller返回的一致
5运行项目查看测试页面数据
http://localhost:8080/hello
阅读全文
0 0
- springboot+Thymeleaf demo 每天进步百分之一
- springboot-helloword 每天进步百分之一
- springboot junit 每天进步百分之一
- springboot- jpa mysql支持 每天进步百分之一
- springboot vue 安装 每天进步百分之一
- springboot redis 集成 每天进步百分之一
- springboot vue 登录页面01 每天进步百分之一
- springboot shiro权限控制讲解01 每天进步百分之一
- 从今天开始,我要尝试每天进步百分之一!
- 从今天开始,我要尝试每天进步百分之一!
- SpringBoot -- thymeleaf
- springboot-thymeleaf
- SpringBoot-thymeleaf
- SpringBoot + thymeleaf
- springboot thymeleaf
- Springboot+ thymeleaf+ easyui (不含数据库) demo
- 每天进步
- 每天进步
- CentOS 6.6安装以mysql
- DLL导出函数示例
- leetcode: 13. Roman to Integer
- 6-19 Count Connected Components(20 point(s))
- 【Ionic2】Ionic2 踩坑记录
- springboot+Thymeleaf demo 每天进步百分之一
- 高企利润成诱人蛋糕,火热现金贷背后暗藏“暴利”风险
- Android 中ViewPager自适应图片高度的问题
- C++继承中关于子类构造函数
- 11.07 学习心得
- 注解 整理
- 20171107
- easyUI获取tree、combotree节点级别
- 编译Android源码