简单使用:SpringBoot使用freemarker
2019-11-05 16:02:14来源:博客园 阅读 ()
简单使用:SpringBoot使用freemarker
a : 添加依赖
b: 创建模板文件 保存位置resources/templates 目录下 文件后缀名.ftl
在resources.templates下创建user.ftl文件,内容如下
<html>
<head>
<title>springboot</title>
</head>
<body>
<table border="1px">
<thead>
<tr>
<th>id</th>
<th>用户名</th>
<th>密码</th>
<th>姓名</th>
</tr>
</thead>
<tbody>
<#list users as user>
<tr>
<td>${user.id}</td>
<td>${user.username}</td>
<td>${user.password}</td>
<td>${user.name}</td>
</tr>
</#list>
</tbody>
</table>
</body>
</html>
dao层:
List<User> getAllUser();
Controller层:
@RequestMapping("/list")
public String show(Model mode){
List<User> users = userDao.findAll();
mode.addAttribute("users",users);
return "user";
}
原文链接:https://www.cnblogs.com/crazy-lc/p/11801412.html
如有疑问请与原作者联系
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- springboot2配置JavaMelody与springMVC配置JavaMelody 2020-06-11
- SpringBoot 2.3 整合最新版 ShardingJdbc + Druid + MyBatis 2020-06-11
- 掌握SpringBoot-2.3的容器探针:实战篇 2020-06-11
- Linux简单命令的学习 2020-06-10
- 因为命名被diss无数次。简单聊聊编程最头疼的事情之一:命名 2020-06-10
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
