FreeMarker Features

xiaoxiao2021-03-06  88

1. General goals

l can generate various texts: HTML, XML, RTF, Java source code, etc.

l Easy to embed your products: lightweight; no servlet environment

l Plug-in template loader: You can load templates from any source, such as local files, databases, etc.

l You can generate text as you want: Save to local files; send it as email; send it from the web application to a web browser

2, powerful template language

l All common instructions: include, IF / Elseif / Else, loop structure

l Create and change variables in the template

l Almost anywhere, you can use complex expressions to specify values.

l Macro named, can have location parameters and nested content

l Namespace helps to build and maintain reusable macro libraries, or divide a large project into modules, but don't worry about the name conflict.

l Output conversion block: When the nested template fragment generates output, convert HTML escape, compression, syntax highlight, etc. You can define your own conversion

3, universal data model

l FreeMarker is not directly reflected to the Java object, the Java object is encapsulated by a plug-in object, displayed in a variable mode in the template.

l You can use abstract (interface) ways to indicate objects (JavaBean, XML document, SQL query results set, etc.), tell template developers to use methods, making it uninterrupted by technical details

4, prepare for web

l The structure of typical web related tasks such as HTML escapes in template language

l can be integrated into the Model2 web application framework as a JSP alternative

l Support JSP tag library

l Design for MVC mode: separation visual design and application logic; separation page designer and programmer

5, intelligent internationalization and localization

l Character set intelligent (use unicode inside)

l Digital format localization sensitive

l Date and time format localization sensitive

l Non-US character set can be used as an identity (such as a variable name)

l Template for a variety of different languages

6, powerful XML processing power

L <#Recurse> and <#visit> Directive (2.3 version) is used to recurrent traversal XML tree

l Clear and intuitive access XML object model in the template

转载请注明原文地址:https://www.9cbs.com/read-101624.html

New Post(0)