com.opensymphony.webwork.sitemesh
Class FreeMarkerPageFilter
java.lang.Object
com.opensymphony.sitemesh.webapp.SiteMeshFilter
com.opensymphony.module.sitemesh.filter.PageFilter
com.opensymphony.webwork.sitemesh.TemplatePageFilter
com.opensymphony.webwork.sitemesh.FreeMarkerPageFilter
- All Implemented Interfaces:
- Filter
public class FreeMarkerPageFilter
- extends TemplatePageFilter
Applies FreeMarker-based sitemesh decorators.
The following variables are available to the decorating freemarker page :-
- ${title} - content of <title> tag in the decorated page
- ${head} - content of <head> tag in the decorated page
- ${body} - content of t<body> tag in the decorated page
- ${page.properties} - content of the page properties
With the following decorated page :-
<html>
<meta name="author" content="tm_jee" />
<head>
<title>My Title</title>
<link rel="stylesheet" type="text/css" href="mycss.css" />
<style type="text/javascript" language="javascript" src="myjavascript.js"></script>
</head>
<body<
<h1>Sample</h1>
</body>
</html>
Properties |
Content |
${title} |
My Title |
${head} |
<link rel="stylesheet" type="text/css" href="mycss.css" />
<style type="text/javascript" language="javascript" src="myjavascript.js"></script>
|
${body} |
<h1>Sample</h1>
|
${page.properties.meta.author} |
tm_jee |
- Version:
- $Date: 2007-01-07 20:20:56 +0800 (Sun, 07 Jan 2007) $ $Id: FreeMarkerPageFilter.java 2792 2007-01-07 12:20:56Z tmjee $
- Author:
- patrick, tm_jee
Methods inherited from class com.opensymphony.sitemesh.webapp.SiteMeshFilter |
destroy, doFilter, initContentProcessor, initDecoratorSelector |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FreeMarkerPageFilter
public FreeMarkerPageFilter()
applyDecorator
protected void applyDecorator(com.opensymphony.module.sitemesh.Page page,
com.opensymphony.module.sitemesh.Decorator decorator,
HttpServletRequest req,
HttpServletResponse res,
ServletContext servletContext,
ActionContext ctx)
throws ServletException,
IOException
- Applies the decorator, using the relevent contexts
- Specified by:
applyDecorator
in class TemplatePageFilter
- Parameters:
page
- The pagedecorator
- The decoratorreq
- The servlet requestres
- The servlet responseservletContext
- The servlet contextctx
- The action context for this request, populated with the server state
- Throws:
ServletException
IOException
getLocale
protected Locale getLocale(ActionInvocation invocation,
freemarker.template.Configuration configuration)
- Returns the locale used for the
Configuration.getTemplate(String, Locale)
call. The base implementation
simply returns the locale setting of the action (assuming the action implements LocaleProvider
) or, if
the action does not the configuration's locale is returned. Override this method to provide different behaviour,