springboot添加freemarker支持

1、application.properties中添加配置

#freemarker config
spring.freemarker.allow-request-override=false
spring.freemarker.cache=false
spring.freemarker.check-template-location=true
spring.freemarker.charset=UTF-8
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=false
spring.freemarker.expose-session-attributes=false
spring.freemarker.expose-spring-macro-helpers=false
#spring.freemarker.prefix=
#spring.freemarker.request-context-attribute=
#spring.freemarker.settings.*=
spring.freemarker.suffix=.ftl
spring.freemarker.template-loader-path=classpath:/templates/

2、pom.xml引入依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>

3、在resources目录下创建templates目录

4、freemarker常用标签

  controller方法中传入ModeMap map; 相当于modeandview

springboot+freemarker的更多相关文章

  1. springboot + freemarker 实现国际化

    前言 写过一篇springboot+freemarker国际化过程中的细节问题,但没有写过具体的国际化实现过程.正好有人在问,我就把我实现的过程贴出来,即使自己知识的一个备份,如果对别人有点用,那是再 ...

  2. springboot+freemarker毕业设计项目错误合集

    1.springboot的主程序类必须在最外层. 换句话说,报错: This application has no explicit mapping for /error, so you are se ...

  3. idea+springboot+freemarker热部署(转)

    今天在学习springboot集成freemarker模板引擎修改代码时,发现每次修改一次freemarker文件时,都必须重启下应用,浏览器刷新才能显示修改后的内容,这样效率太低,每次启动一次应用都 ...

  4. 用maven配置springboot+freemarker

    1.创建项目 直接点下一步   原因: 不勾选 Create from archetype,是项目创建的骨架的时候,由于不知道什么原因就卡住了,一直在刷新 2.创建之后完成之后 添加依赖 <pa ...

  5. SpringBoot系统列 5 - 接口版本控制、SpringBoot FreeMarker模板引擎

    接着上篇博客的代码继续写 1.接口版本控制 一个系统上线后会不断迭代更新,需求也会不断变化,有可能接口的参数也会发生变化,如果在原有的参数上直接修改,可能会影响线上系统的正常运行,这时我们就需要设置不 ...

  6. SpringBoot+FreeMarker开发word文档下载,预览

    背景: 开发一个根据模版,自动填充用户数据并下载word文档的功能 使用freemarker进行定义模版,然后把数据进行填充. maven依赖: <parent> <groupId& ...

  7. springboot + freemarker 实现计算器

    使用RequestParam("") 接受参数 其后参数有自动类型转换的作用 @RequestParam("firstNumber") double first ...

  8. Springboot + Freemarker(一)

    Maven pom文件配置 <parent> <groupId>org.springframework.boot</groupId> <artifactId& ...

  9. idea 关闭自动保存,未保存星号提醒, springboot + freemarker 热部署

    1,自动保存 File > setting 去掉下图勾选 2,未保存文件星号提示 File > Settings 3,spring boot 项目 热部署 3.1,pom文件添加依赖 &l ...

随机推荐

  1. openvpn部署账号密码登录

    1.开启服务器端路由转发功能: 修改配置文件/etc/sysctl.conf中 net.ipv4.ip_forward = 0 改为 net.ipv4.ip_forward = 1 [root@nod ...

  2. Mysql中INSERT ... ON DUPLICATE KEY UPDATE的实践

    转: Mysql中INSERT ... ON DUPLICATE KEY UPDATE的实践 阿里加多 0.1 2018.03.23 17:19* 字数 492 阅读 2613评论 2喜欢 1 一.前 ...

  3. C++ template一些体悟(1)

    #include <iostream> using namespace std; template<typename T> class testClass { public: ...

  4. python3自带工具2to3.py用法

    在跑程序的过程中,常常会出现找到的代码是python2但是实际搭建的环境是python3的情况,在这种情况下,我们常常有两个选择: (1)将现有的环境配置成python2的情况 (2)将现有程序由py ...

  5. (二叉树 BFS DFS) leetcode 111. Minimum Depth of Binary Tree

    Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...

  6. tcpdump高级过滤

    一:查看帮助选项 tcpdump --help Usage: tcpdump [-aAbdDefhHIJKlLnNOpqStuUvxX#] [ -B size ] [ -c count ] [ -C ...

  7. rownum查询前N条记录

    在Oracle中,要按特定条件查询前N条记录,用个rownum就搞定了.——select * from emp where rownum <= 5 而且书上也告诫,不能对rownum用" ...

  8. python kafka

    转载:https://zhuanlan.zhihu.com/p/31731892 https://kafka-python.readthedocs.io/en/master/usage.html

  9. iptables之端口限速

    #iptables -A FORWARD -p tcp -m tcp --sport 10000 -m limit --limit 500/sec --limit-burst 1000 -j ACCE ...

  10. Hbase 1.3.0 Rsgroup

    HBase RSGroup Git环境window环境下,警用crlf自动转换git config --global core.autocrlf false protobuf环境yum install ...