Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleAbout SiteMesh

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.

(warning) The framework integrates with SiteMesh via a plugin provided in the standard distribution. An application must include the sitemesh-plugin.jar on its classpath to utilize this featureThe Sitemesh plugin

Excerpt

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!

Features

  • Can use Struts tags in Sitemesh decorator templates

Usage

ActionContextCleanUp

Under the framework's Architecture architecture, the standard filter-chain optionally starts with the ActionContextCleanUp filter, followed by other desired filters. Lastly, the FilterDispatcher handles the request, usually passing it on to the ActionMapper. The primary purpose of the ActionContextCleanUp is to provide SiteMesh integration. The clean-up filter tells the dispatcher filter exactly when to remove obsolete objects from the request. Otherwise, the ActionContext may be removed before the decorator attempts to access it.

...

FreeMarker and Velocity Decorators

The framework plugin provides an extension of the SiteMesh PageFilter to assist with integration with Velocity and FreeMarker. Our filters provide the standard variables and Struts Tags that you used to create views in your favorite template language.

...

In the web.xml, the VelocityPageFilter should be placed between the ActionContextCleanUp and the FilterDispatcher.

{snippet:id=example.freemarker.filter.chain|javadoc=false|lang=xml|url=struts2/apps/showcase/src/main/webapp/WEB-INF/web.xml}
Info
titleJavadoc: (exampleorg.apache.freemarkerstruts2.filtersitemesh.chain)
Wiki Markup
FreeMarkerPageFilter)
Wiki Markup
{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.sitemesh.FreeMarkerPageFilter}

...

In the web.xml, the VelocityPageFilter should be placed between the ActionContextCleanUp and the FilterDispatcher.

Example

Here is an example of how to configure the filter chains in web.xml:

Wiki Markup
{snippet:id=example.freemarker.filter.chain|javadoc=false|lang=xml|url=struts2/apps/showcase/src/main/webapp/WEB-INF/web.xml}

Settings

This plugin doesn't support any global settings.

Installation

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.