1. opensymphony
  2. webwork


webwork / docs / freemarker.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <title>WebWork Documentation</title>
  <link type="text/css" href="main.css" rel="STYLESHEET"/>
  <div id="page-logo">
    <a href="index.html"><img src="logo-small.png" border="0"/></a>
    <div class="snip-title">
	  <h1 class="snip-name">FreeMarkerResult
<div id="snip-content" class="snip-content">

 <div class="snip-attachments"></div>
 <span class="nobr"><img src="http://wiki.opensymphony.com/images/external-link.png" alt="&gt;&gt;" border="0"/><a href="http://www.freemarker.org/index.html">FreeMarker</a></span> Result implementation based on VelocityResult. Distributed under the BSD license.<p class="paragraph"/>Download:
<span class="nobr"><img src="http://wiki.opensymphony.com/images/external-link.png" alt="&gt;&gt;" border="0"/><a href="http://www.fw2.net/files/xwork-freemarker-1.0.zip">&#104;ttp://www.fw2.net/files/xwork-freemarker-1.0.zip</a></span> (15kB, includes source)
<h3 class="heading-1">This result type isn't complete.
</h3><p class="paragraph"/>It doesn't support all of the features that the FreemarkerServlet supports.  
<ul class="star">
<li>Support for using JSP tags within FLT templates.</li>
</ul><p class="paragraph"/>I am using freemarker by using the freemarker servlet.  I just use the the dispatcher result, specifying the template location.  Also, I am using the WebWorkJstlFilter which hooks up the ValueStack to the request, allowing the action properties to be resolved through HttpServletRequest.getAttribute(String name) which the freemarker engine calls when it can't find a local script variable for an expression.<p class="paragraph"/>ie.<p class="paragraph"/>if you have an action with a property getThingy() and in your template :<p class="paragraph"/>&#60;p&#62;${thingy}&#60;/p&#62;<p class="paragraph"/>freemarket tries to resolve "thingy" as a local script variable, which it won't be able to.  Then it searches the scopes page,request,session,application to try and resolve it.<p class="paragraph"/>Using the provided request wrapping filter, the valueStack is slipped in between request and session.