SiteMesh is a web-page layout and decoration framework and web application integration framework to aid in creating large sites consisting of many pages for which a consistent look/feel, navigation and layout scheme is required.
The Sitemesh plugin allows Sitemesh templates to access framework resources.
The framework stores all its value stack information as request attributes, meaning that if you wish to display data that is on the stack (or even the ActionContext), you can do so by using the normal tag libraries that come with the framework. That's it!
- Can use Struts tags in Sitemesh decorator templates
- Sitemesh decorators can be written in FreeMarker as well as Velocity and JSP
From 2.2+ the new
com.opensymphony.sitemesh.webapp.SiteMeshFilter filter and Struts
org.apache.struts2.dispatcher.ng.listener.StrutsListener context listener must be added to
FreeMarker and Velocity Decorators
The plugin provides an extension of the SiteMesh Velocity and FreeMarker servlets. These servlets provide the standard variables and Struts Tags that you used to create views in your favourite template language.
From 2.2+ the recommended way to use Freemarker with Sitemesh is through the
org.apache.struts2.sitemesh.FreemarkerDecoratorServlet servlet, which can be configured like this in
From 2.2+ the recommended way to use Velocity with Sitemesh is through the
org.apache.struts2.sitemesh.VelocityDecoratorServlet servlet, which can be configured like this in
Full integration with SiteMesh 2 + Freemarker 2.4.2 + Velocity 1.3 , including Struts 2 Tags, ValueStack, and FreemarkerManager statics.
Such configuration is available as from Struts 2.2.0, please refer to WW-3296 for me details.
Here is an example of how to configure the filter chains in
Struts 2.1 web.xml filter chain example:
You do not need the struts2-sitmesh-plugin if you are using JSP for your decorators.
Here are the only only changes needed to web.xml
This plugin doesn't support any global settings.
This plugin can be installed by copying the plugin jar into your application's
/WEB-INF/lib directory. No other files need to be copied or created.