webwork / docs / freemarker.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" 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="" alt="&gt;&gt;" border="0"/><a href="">FreeMarker</a></span> Result implementation based on VelocityResult. Distributed under the BSD license.<p class="paragraph"/>Download:
<span class="nobr"><img src="" alt="&gt;&gt;" border="0"/><a href="">&#104;ttp://</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.