FreeMarker is a templating framework that can be used as a replacement for JavaServer Pages (JSP). Tiles can be used with FreeMarker because FreeMarker templates can use JSP tag libraries.
To use JSP support in FreeMarker, add this piece of configuration (the parameters can be modified as needed).
<servlet> <servlet-name>freemarker</servlet-name> <servlet-class>freemarker.ext.servlet.FreemarkerServlet</servlet-class> <!-- FreemarkerServlet settings: --> <init-param> <param-name>TemplatePath</param-name> <param-value>/</param-value> </init-param> <init-param> <param-name>NoCache</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>ContentType</param-name> <param-value>text/html</param-value> </init-param> <!-- FreeMarker settings: --> <init-param> <param-name>template_update_delay</param-name> <param-value>0</param-value> <!-- 0 is for development only! Use higher value otherwise. --> </init-param> <init-param> <param-name>default_encoding</param-name> <param-value>ISO-8859-1</param-value> </init-param> <init-param> <param-name>number_format</param-name> <param-value>0.##########</param-value> </init-param> <load-on-startup>5</load-on-startup> </servlet>
To use Tiles JSP tag libraries in FreeMarker templates, add this line in every page that needs Tiles:
<#assign tiles=JspTaglibs["http://tiles.apache.org/tags-tiles"]>