Using FreeMarker in a JSP taglib

September 6, 2009

Simple steps to create a JSP taglib which (internally) uses the FreeMarker engine for generating the output .

The JSP taglib is responsible for defining the name, attributes and behavior of the tag whilst the generation of the output (i.e. html code, predefined text template) is delegated to the FreeMarker engine.

This technique brings various advantages such as the separation of responsibilities (“presentation-designer” vs “business-programmer”), better maintenance and extendibility.

The approach is similar to the Struts2 JSP tags: this is just a simpler implementation to see what happens behind the scene.

Read the rest of this entry »