Configuring your action to use the freemarker result type


  • Freemarker views are rendered via the webwork result type freemarker, or by using the dispatcher result type in conjunction Webwork's FreemarkerServlet.

  • We use the freemarker result type which is defined in xwork-community.xml, so you can simply use it like so:


<action name="test" class="package.Test">
    <result name="success" type="freemarker">


  • Since freemarker is defined as the default result type, type="freemarker" is not necessary when declaring your action.


Property Resolution


  • Your action properties are automatically resolved. FOR EXAMPLE:


${name} will result in stack.findValue("name"), which generally results in action.getName() being executed.


  • A search process is used to resolve the variable, searching the following scopes in order, until a value is found:

1.) Freemarker Variables 
2.) Webwork Value Stack 
3.) Request Attributes 
4.) Session Attributes 
5.) Servlet Context Attributes



Objects in the Context


  • Webwork objects added to the context

    • request - the current HttpServletRequest

    • response - the current HttpServletResponse

    • stack - the current OgnlValueStack

    • ognl - the OgnlTool instance. This class contains useful methods to execute OGNL expressions against arbitary objects

    • webwork ? an instance of FreemarkerWebWorkUtil

    • action - the current WebWork action

    • exception - optional the Exception instance, if the view is a JSP exception or Servlet exception


  • Jive objects added to the context

    • JiveGlobals

    • JiveConstants

    • LocaleUtils

    • StringUtils

    • DateUtils

    • SkinUtils

    • Permissions

    • IMSettingsUtils

    • ActionUtils

    • RSSActionSupport

    • ViewCountManager

    • CommunityUtils

    • BlogUtils

    • FeedUtils

    • WikiUtils

    • LicenseManager

    • DocumentPermHelper

    • MessagePermHelper


${JiveGlobals.getJiveProperty(?skin.defaultHeader?)?default(?Community Home?)}


  • In addition, static models and enums can be referenced as so:


where ) is replaced with ] and ( is replaced with [