org.apache.struts2.sitemesh
Class FreeMarkerPageFilter
java.lang.Object
com.opensymphony.module.sitemesh.filter.PageFilter
org.apache.struts2.sitemesh.TemplatePageFilter
org.apache.struts2.sitemesh.FreeMarkerPageFilter
- All Implemented Interfaces:
- com.opensymphony.module.sitemesh.RequestConstants, javax.servlet.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: 2008-04-27 13:41:38 +0000 (Sun, 27 Apr 2008) $ $Id: FreeMarkerPageFilter.java 651946 2008-04-27 13:41:38Z apetrelli $
Fields inherited from class com.opensymphony.module.sitemesh.filter.PageFilter |
factory |
Fields inherited from interface com.opensymphony.module.sitemesh.RequestConstants |
DECORATOR, FILTER_APPLIED, PAGE, ROBOT, USING_STREAM |
Method Summary |
protected void |
applyDecorator(com.opensymphony.module.sitemesh.Page page,
com.opensymphony.module.sitemesh.Decorator decorator,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
javax.servlet.ServletContext servletContext,
com.opensymphony.xwork2.ActionContext ctx)
Applies the decorator, using the relevent contexts |
protected java.util.Locale |
getLocale(com.opensymphony.xwork2.ActionInvocation invocation,
freemarker.template.Configuration configuration)
Returns the locale used for the Configuration.getTemplate(String, Locale) call. |
static void |
setFreemarkerManager(org.apache.struts2.views.freemarker.FreemarkerManager mgr)
|
Methods inherited from class com.opensymphony.module.sitemesh.filter.PageFilter |
destroy, doFilter, getFilterConfig, parsePage, setFilterConfig, writeDecorator |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FreeMarkerPageFilter
public FreeMarkerPageFilter()
setFreemarkerManager
public static void setFreemarkerManager(org.apache.struts2.views.freemarker.FreemarkerManager mgr)
applyDecorator
protected void applyDecorator(com.opensymphony.module.sitemesh.Page page,
com.opensymphony.module.sitemesh.Decorator decorator,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
javax.servlet.ServletContext servletContext,
com.opensymphony.xwork2.ActionContext ctx)
throws javax.servlet.ServletException,
java.io.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:
javax.servlet.ServletException
java.io.IOException
getLocale
protected java.util.Locale getLocale(com.opensymphony.xwork2.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,
Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.