<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/clearspace/rss" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Jivespace Community Blog</title>
    <link>http://www.jivesoftware.com/jivespace/blogs/jivespace</link>
    <description>Jivespace Developer Community Blog</description>
    <pubDate>Thu, 31 Jan 2008 16:56:52 GMT</pubDate>
    <generator>Clearspace 2.5.5 (http://jivesoftware.com/products/clearspace/)</generator>
    <dc:date>2008-01-31T16:56:52Z</dc:date>
    <item>
      <title>Freemarker w/ WebWork Tutorial</title>
      <link>http://www.jivesoftware.com/jivespace/blogs/jivespace/2008/01/31/freemarker-w-webwork-tutorial</link>
      <description>&lt;!-- [DocumentBodyStart:1863cdb2-20d4-4bc7-ae59-a96aa6a0dd4e] --&gt;&lt;div class='jive-rendered-content'&gt;&lt;h3&gt;&lt;span&gt;Configuring your action to use the freemarker result type&lt;/span&gt;&lt;/h3&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;Freemarker views are rendered via the webwork result type freemarker, or by using the dispatcher result type in conjunction Webwork's FreemarkerServlet.&lt;/p&gt;&lt;/li&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;We use the freemarker result type which is defined in xwork-community.xml, so you can simply use it like so:&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;!--[CodeBlockStart:db730ae5-2c73-49ff-b186-d010c5c89882]--&gt;&lt;pre class="jive-pre"&gt;&lt;code class="jive-code jive-xml"&gt;
&lt;span class="jive-xml-tag"&gt;&amp;lt;action name="test" class="package.Test"&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="jive-xml-tag"&gt;&amp;lt;result name="success" type="freemarker"&amp;gt;&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /templates/testView.ftl
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="jive-xml-tag"&gt;&amp;lt;/result&amp;gt;&lt;/span&gt; 
&lt;span class="jive-xml-tag"&gt;&amp;lt;/action&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;!--[CodeBlockEnd:db730ae5-2c73-49ff-b186-d010c5c89882]--&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;Since freemarker is defined as the default result type, type="freemarker" is not necessary when declaring your action.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;h3&gt;&lt;span&gt;Property Resolution&lt;/span&gt;&lt;/h3&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;Your action properties are automatically resolved. FOR EXAMPLE:&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;!--[CodeBlockStart:d46e8fbb-426a-400c-aafa-2be09b0ac092]--&gt;&lt;pre class="jive-pre"&gt;&lt;code class="jive-code"&gt;
${name} will result in stack.findValue("name"), which generally results in action.getName() being executed.
&lt;/code&gt;&lt;/pre&gt;&lt;!--[CodeBlockEnd:d46e8fbb-426a-400c-aafa-2be09b0ac092]--&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;A search process is used to resolve the variable, searching the following scopes in order, until a value is found:&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;!--[CodeBlockStart:2c789cd0-4efb-47d1-a5c6-864a1a41bdc5]--&gt;&lt;pre class="jive-pre"&gt;&lt;code class="jive-code"&gt;
1.) Freemarker Variables 
2.) Webwork Value Stack 
3.) Request Attributes 
4.) Session Attributes 
5.) Servlet Context Attributes
&lt;/code&gt;&lt;/pre&gt;&lt;!--[CodeBlockEnd:2c789cd0-4efb-47d1-a5c6-864a1a41bdc5]--&gt;&lt;p&gt; &lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;h3&gt;&lt;span&gt;Objects in the Context&lt;/span&gt;&lt;/h3&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;Webwork objects added to the context&lt;/p&gt;&lt;/li&gt;&lt;ul&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;&lt;strong&gt;request&lt;/strong&gt; - the current HttpServletRequest &lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;&lt;strong&gt;response&lt;/strong&gt; - the current HttpServletResponse &lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;&lt;strong&gt;stack&lt;/strong&gt; - the current OgnlValueStack &lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;&lt;strong&gt;ognl&lt;/strong&gt; - the OgnlTool instance. This class contains useful methods to execute OGNL expressions against arbitary objects&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;&lt;strong&gt;webwork&lt;/strong&gt; ? an instance of FreemarkerWebWorkUtil&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;&lt;strong&gt;action&lt;/strong&gt; - the current WebWork action &lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;&lt;strong&gt;exception&lt;/strong&gt; - optional the Exception instance, if the view is a JSP exception or Servlet exception&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;Jive objects added to the context&lt;/p&gt;&lt;/li&gt;&lt;ul&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;JiveGlobals&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;JiveConstants&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;LocaleUtils&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;StringUtils&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;DateUtils&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;SkinUtils&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;Permissions&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;IMSettingsUtils&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;ActionUtils&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;RSSActionSupport&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;ViewCountManager&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;CommunityUtils&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;BlogUtils&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;FeedUtils&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;WikiUtils&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;LicenseManager&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;DocumentPermHelper&lt;/p&gt;&lt;/li&gt;&lt;li level="2" type="ul"&gt;&lt;p&gt;MessagePermHelper&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;!--[CodeBlockStart:6c688f54-199e-4e63-948f-64d76eeef513]--&gt;&lt;pre class="jive-pre"&gt;&lt;code class="jive-code"&gt;
${JiveGlobals.getJiveProperty(?skin.defaultHeader?)?default(?Community Home?)}
&lt;/code&gt;&lt;/pre&gt;&lt;!--[CodeBlockEnd:6c688f54-199e-4e63-948f-64d76eeef513]--&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li level="1" type="ul"&gt;&lt;p&gt;In addition, static models and enums can be referenced as so:&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;!--[CodeBlockStart:18ff4e1c-f2ba-4ede-a911-0e76b25a5acb]--&gt;&lt;pre class="jive-pre"&gt;&lt;code class="jive-code"&gt;
${statics('com.jivesoftware.community.action.CommunityAction').VIEW_OVERVIEW}
${enums('com.jivesoftware.community.SearchQueryCriteria$SortType').RELEVANCE.key?c}
where ) is replaced with ] and ( is replaced with [
&lt;/code&gt;&lt;/pre&gt;&lt;!--[CodeBlockEnd:18ff4e1c-f2ba-4ede-a911-0e76b25a5acb]--&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:1863cdb2-20d4-4bc7-ae59-a96aa6a0dd4e] --&gt;</description>
      <category domain="http://www.jivesoftware.com/jivespace/blogs/jivespace/tags">clearspace</category>
      <category domain="http://www.jivesoftware.com/jivespace/blogs/jivespace/tags">freemarker</category>
      <category domain="http://www.jivesoftware.com/jivespace/blogs/jivespace/tags">webwork</category>
      <category domain="http://www.jivesoftware.com/jivespace/blogs/jivespace/tags">tutorial</category>
      <pubDate>Thu, 31 Jan 2008 16:57:59 GMT</pubDate>
      <author>nick@jivesoftware.com</author>
      <guid>http://www.jivesoftware.com/jivespace/blogs/jivespace/2008/01/31/freemarker-w-webwork-tutorial</guid>
      <dc:date>2008-01-31T16:57:59Z</dc:date>
      <clearspace:dateToText>11 months, 1 week ago</clearspace:dateToText>
      <wfw:comment>http://www.jivesoftware.com/jivespace/blogs/jivespace/comment/freemarker-w-webwork-tutorial</wfw:comment>
      <wfw:commentRss>http://www.jivesoftware.com/jivespace/blogs/jivespace/feeds/comments?blogPost=1380</wfw:commentRss>
    </item>
  </channel>
</rss>

