最近用到 FreeMarker ,一种Java后端的模板引擎。
遂想起用 IDEA IU 的 Spring Initializer
直接快速新建 SpringBoot 项目的时候,有列出其他几种模板引擎。于是特地安装查看。
其实在安装之前,通过搜索也找到了一些其他结果。汇总结果见下。
模板引擎
从 start.spring.io
分别整理以下模板引擎的介绍。
Thymeleaf
A modern server-side Java template engine for both web and standalone environments.
Allows HTML to be correctly displayed in browsers and as static prototypes.
一种现代的、Java服务端的模板引擎,即可用于web,也可独立运行。
它允许HTML在浏览器中被正确地显示。它是一种静态地原型。
Apache Freemarker
Java library to generate text output (HTML web pages, e-mails, configuration files, source code, etc.)
based on templates and changing data.
可用于生成文本输出的Java库,基于模板和动态变化的数据output = template + data
。
文本输出可以是:HTML页面,email, 配置文件,源码……
Mustache
Logic-less Templates. There are no if statements, else clauses, or for loops. Instead there are only tags.
一种逻辑更少的模板,没有if/else/for等语句,取而代之的只剩下tags。
Groovy Templates
Groovy templating engine.
Groovy 是另一门编程语言。目前生态并非最好。
更多
-
velocity
也是apache的。 -
Jade4j
我记得之前使用 express 框架(JavaScript的后端框架)的时候,也有制定过模板,其中一种就是jade
Java 模板引擎 选用
FreeMarker
官网:https://freemarker.apache.org/
中文翻译: http://freemarker.foofun.cn/