2.3.11 - Apache FreeMarker Manual

Unsupported web browser - Use a modern browser to view this website!

- Home
- Manual
- Java API

- Contribute
- Report a Bug
- Download

Manual
Previous Next

# 2.3.11

Date of release: 2007-12-04

This release contains several performance and usability improvements.

## Changes on the FTL side

- Bug fixed: [1687248] Warning! This bugfix may breaks some templates! Fixed the bugs of the `c` built-in (`?c`) that sometimes caused whole numbers to be formatted with ".0" at the end (like: 1.0), and caused numbers sometimes formatted to exponential form (like 4E-20). From now whole numbers will never use decimal dot (not even if the wrapped number is a `double`; remember, the template language knows only a single numerical type), and exponential form will never be used either. Also, the maximum number of digits after the decimal dot was limited to 16, so numbers smaller than 1E-16 will be shown as 0.

## Changes on the Java side

- FreeMarker now has much better JSP 2.0 and JSP 2.1 compliance. Most notably, the JSP 2.0 `SimpleTag` interface is now supported. Additionally, even when run in an environment that doesn't have its own JSP implementation, the FreeMarker JSP runtime will make available its own implementation of `JspFactory` and `JspEngineInfo` to tags when JSP 2.0 API JAR is available in classpath, as well as an implementation of `JspApplicationContext` when JSP 2.1 API JAR is available in classpath.

- A new model interface, `TemplateDirectiveModel` provides an easier paradigm for implementing user-defined directives than `TemplateTransformModel` did previously. `TemplateTransformModel` will be deprecated.

- FreeMarker now finds the Xalan-based XPath support included in Sun JRE/JDK 5 and 6, so no separate Xalan jar is required for the XPath support to work. (However, we recommend Jaxen over Xalan, as the FreeMarker XPath support is more complete with that. Of course for that the Jaxen jar is still needed.)

- Wrapping performance of `BeansWrapper` has been significantly improved by eliminating repetitive execution of various class tests.

  Note for `BeansWrapper` customizers: subclasses of `BeansWrapper` that previously overrode `getInstance(Object, ModelFactory)` method should now instead override `getModelFactory(Class)` to take advantage of this improvement. Overriding the old method still works, but it will not take advantage of the performance improvement.

- Memory footprint of a wrapper created by `BeansWrapper` has been reduced (by a size of one default-sized `HashMap`) until methods or indexed properties are accessed on it (simple properties can be accessed without increasing memory footprint).

- Rhino objects can be used in templates as scalars, numbers, and booleans, following the JavaScript conversion semantics for these types.

- `.data_model` is now a `TemplatHashModelEx` when possible. This means that the list of the data-model variable names usually can be get with `.data_model?keys`.

- `FileTemplateLoader` can now optionally allow following symlinks that point out of the base directory. It is disabled by default for backward compatibility.

- Bug fixed: [1670887] `TaglibFactory` taglib matching did not follow JSP 1.2 FCS.

- Bug fixed: [1754320] Bug in `setXPathSupportClass` prevented plugging in a user-supplied `XPathSupport` implementation.

- Bug fixed: [1803298] Parser error while parsing macro with loop variables

- Bug fixed: [1824122] Loading templates from JAR files could lead to leaking of file handles (due to a bug in the Java API implementation of Sun).

- Bug fixed: Cached template is now removed from the cache if the re-loading of the modified template file fails, so no staled template is served.

## Documentation changes

- Substantial reworkings in the Template Authors's Guide (which was previously called Designer's Guide), especially in the Getting Started section.

- `#{...}` is documented as deprected construct from now.

- The "transform" term is now removed from the documentation. Instead the more general "user-defined directive" term is used, which encompasses macros, `TemplateTransformModel`-s and the new `TemplateDirectiveModel`-s, which are just different ways of implementing user-defined directives.

- Some more minor improvements in the Manual.

Previous Next