使用步骤:

a : 添加依赖

b: 创建模板文件 保存位置resources/templates 目录下 文件后缀名.ftl

c 编写controller 把结果传递给模板

在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";
}

简单使用:SpringBoot使用freemarker的更多相关文章

  1. 基于springboot的freemarker创建指定格式的word文档

    在web或其他应用中,经常我们需要导出或者预览word文档,比较实际的例子有招聘网站上预览或者导出个人简历,使用POI导出excel会非常的方便,但是如果想导出word,由于其格式控制非常复杂,故而使 ...

  2. SpringBoot整合freemarker 引用基础

    原 ElasticSearch学习笔记Ⅲ - SpringBoot整合ES 新建一个SpringBoot项目.添加es的maven坐标如下: <dependency> <groupI ...

  3. springboot整合freemarker

    前后端分离现在越来越多,如何有效的使用springboot来整合我们的页面是一个很重要的问题. springboot整合freemarker有以下几个步骤,也总结下我所犯的错误: 1.加依赖: 2.配 ...

  4. springboot使用Freemarker继承

    最近需要用到Freemarker的继承.但是发现没有关于springboot配置Freemarker的继承的.所以趁现在有时间写个博客. 1. Freemarker继承介绍 Freemarker 通过 ...

  5. 记springboot+mybatis+freemarker+bootstrap的使用(1)

    一..springboot的配置 1.安装并配置maven maven是项目管理工具,可以自动下载并管理jar包之间的依赖关系,可通过maven自动配置springboot 参照百度经验https:/ ...

  6. SpringBoot学习8:springboot整合freemarker

    1.创建maven项目,添加pom依赖 <!--springboot项目依赖的父项目--> <parent> <groupId>org.springframewor ...

  7. springboot整合freemarker(转)

    添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>sp ...

  8. 一个最简单的springboot

    现在项目里使用springboot,平时开发并不太关注springboot的一些基本配置,现在想整理一下springboot相关内容. 实际开发中都会因为各种业务需求在springboot上添加很多东 ...

  9. springboot 使用 freemarker 无法正常跳转的问题?

    1.springboot 使用 freemarker 无法正常跳转的问题? 参考:https://blog.csdn.net/Lin_xiaofeng/article/details/79122053 ...

  10. springboot 整合 freemarker

    springboot 整合 freemarker 依赖 <parent> <groupId>org.springframework.boot</groupId> & ...

随机推荐

  1. LCD RGB 控制技术 时钟篇(下)【转】

    上一篇博文,我们介绍了LCD RGB控制模式的典型时钟.那么这一片我们要详细的去讨论剩下的细节部分. 我们先回顾一下之前的典型时序图 在这个典型的时序图里面,除了上篇博文讲述的HSYNC VSYNC ...

  2. 使用Azure进行自动化机器学习

    什么是自动化机器学习? 自动化的机器学习,也称为 AutoML,让数据科研人员. 分析人员和开发人员,同时维护模型质量构建具有高缩放性. 效率和工作效率的机器学习模型. 自动化机器学习生成的机器学习模 ...

  3. 【bzoj4559】[JLoi2016]成绩比较(dp+拉格朗日插值)

    bzoj 题意: 有\(n\)位同学,\(m\)门课. 一位同学在第\(i\)门课上面获得的分数上限为\(u_i\). 定义同学\(A\)碾压同学\(B\)为每一课\(A\)同学的成绩都不低于\(B\ ...

  4. 第十一周小组Scrum会议

    会议照片 本周会议内 回顾上一周的内容 总结上一轮的得失: 我们在第一轮中,并没有做出什么东西,为此我们痛定思痛,制定了计划,确定第二轮迭代的目标: 1. 实现小程序与后台代码的交互 2. 将检索书籍 ...

  5. CodeForces 984C Finite or not?

    http://codeforces.com/problemset/problem/984/C Time limit    1000 msMemory limit    262144 kB 题目 You ...

  6. C++ try catch 示例代码

    #include<iostream> void f1() { throw std::string("error happen"); } void f2() { try ...

  7. Angular7入门总结篇

  8. Introduction to Semidefinite Programming (SDP)

    https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-251j-introduction-to-mathe ...

  9. windows端口转发工具(LCX)

    端口转发(Port forwarding),有时被叫做隧道,是安全壳(SSH) 为网络安全通信使用的一种方法.端口转发是转发一个网络端口从一个网络节点到另一个网络节点的行为,其使一个外部用户从外部经过 ...

  10. 赞!这款国产的SSH工具,好用到爆!

    之前分享 MobaXterm 时 有小伙伴留言说到了 FinalShell 我本来是一脸蒙蔽的 网上搜了一下 它们家的官网 打开官网 我一度怀疑自己进错了网站 简单(jianlou)的排版 像极了上个 ...