This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/struts-site.git
The following commit(s) were added to refs/heads/asf-site by this push: new ecc9b53 Updates production by Jenkins ecc9b53 is described below commit ecc9b53dacb86c6125659e0f239d2a97f89274d8 Author: jenkins <bui...@apache.org> AuthorDate: Thu Oct 4 06:45:54 2018 +0000 Updates production by Jenkins --- content/core-developers/freemarker-support.html | 89 ++++++++++--------------- 1 file changed, 35 insertions(+), 54 deletions(-) diff --git a/content/core-developers/freemarker-support.html b/content/core-developers/freemarker-support.html index b01a0ee..50c6cc7 100644 --- a/content/core-developers/freemarker-support.html +++ b/content/core-developers/freemarker-support.html @@ -129,11 +129,11 @@ <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/core-developers/freemarker-support.md" title="Edit this page on GitHub">Edit on GitHub</a> <h1 id="freemarker-support">Freemarker Support</h1> -<p>Freemarker views can be rendered using the webwork result type <code class="highlighter-rouge">freemarker</code>.</p> +<p>Freemarker views can be rendered using a result type <code class="highlighter-rouge">freemarker</code>.</p> -<p><strong>Configure your action to use the freemarker result type</strong></p> +<h2 id="configure-your-action-to-use-the-freemarker-result-type">Configure your action to use the freemarker result type</h2> -<p>The <code class="highlighter-rouge">freemarker</code> result type is defined in <code class="highlighter-rouge">struts-default.xml</code>, so normally you just include it, and define your resuts to use <code class="highlighter-rouge">type="freemarker"</code>.</p> +<p>The <code class="highlighter-rouge">freemarker</code> result type is defined in <code class="highlighter-rouge">struts-default.xml</code>, so normally you just include it, and define your results to use <code class="highlighter-rouge">type="freemarker"</code>.</p> <div class="highlighter-rouge"><pre class="highlight"><code><span class="nt"><include</span> <span class="na">file=</span><span class="s">"struts-default.xml"</span><span class="nt">/></span> ... @@ -145,81 +145,61 @@ </code></pre> </div> -<p><strong>Property Resoloution</strong></p> +<h2 id="property-resolution">Property Resolution</h2> <p>Your action properties are automatically resolved - just like in a velocity view.</p> -<p><strong>for example</strong> -<code class="highlighter-rouge">${name}</code> will result in <code class="highlighter-rouge">stack.findValue("name")</code>, which <em>generaly</em> results in <code class="highlighter-rouge">action.getName()</code> being executed.</p> +<p><strong>for example</strong></p> -<p>A search process is used to resolve the variable, searching the following scopes in order, until a value is found :</p> +<p><code class="highlighter-rouge">${name}</code> will result in <code class="highlighter-rouge">stack.findValue("name")</code>, which <em>generally</em> results in <code class="highlighter-rouge">action.getName()</code> being executed.</p> + +<p>A search process is used to resolve the variable, searching the following scopes in order, until a value is found:</p> <ul> - <li> - <p>freemarker variables</p> - </li> - <li> - <p>value stack</p> - </li> - <li> - <p>request attributes</p> - </li> - <li> - <p>session attributes</p> - </li> - <li> - <p>servlet context attributes</p> - </li> + <li>freemarker variables</li> + <li>value stack</li> + <li>request attributes</li> + <li>session attributes</li> + <li>servlet context attributes</li> </ul> -<p><strong>Objects in the Context</strong></p> +<h2 id="objects-in-the-context">Objects in the Context</h2> -<p>The following variables exist in the FreeMarker views</p> +<p>The following variables exist in the FreeMarker views:</p> <ul> - <li> - <p><code class="highlighter-rouge">req</code> - the current HttpServletRequest</p> - </li> - <li> - <p><code class="highlighter-rouge">res</code> - the current HttpServletResponse</p> - </li> - <li> - <p><code class="highlighter-rouge">stack</code> - the current OgnlValueStack</p> - </li> - <li> - <p><code class="highlighter-rouge">ognl</code> - the OgnlTool instance</p> - + <li><code class="highlighter-rouge">req</code> - the current <code class="highlighter-rouge">HttpServletRequest</code></li> + <li><code class="highlighter-rouge">res</code> - the current <code class="highlighter-rouge">HttpServletResponse</code></li> + <li><code class="highlighter-rouge">stack</code> - the current <code class="highlighter-rouge">OgnlValueStack</code></li> + <li><code class="highlighter-rouge">ognl</code> - the <code class="highlighter-rouge">OgnlTool</code> instance <ul> - <li>This class contains useful methods to execute OGNL expressions against arbitary objects, and a method to generate a select list using the <s:select> pattern. (i.e. taking the name of the list property, a listKey and listValue)</li> + <li>This class contains useful methods to execute OGNL expressions against arbitary objects, and a method to generate a select list using +the <code class="highlighter-rouge"><s:select/></code> pattern. (i.e. taking the name of the list property, a listKey and listValue)</li> </ul> </li> - <li> - <p><code class="highlighter-rouge">struts</code> - an instance of StrutsBeanWrapper</p> - </li> - <li> - <p><code class="highlighter-rouge">action</code> - the current Struts action</p> - </li> - <li> - <p><code class="highlighter-rouge">exception</code> - <em>optional</em> the Exception instance, if the view is a JSP exception or Servlet exception view</p> - </li> + <li><code class="highlighter-rouge">struts</code> - an instance of <code class="highlighter-rouge">StrutsBeanWrapper</code></li> + <li><code class="highlighter-rouge">action</code> - the current Struts action</li> + <li><code class="highlighter-rouge">exception</code> - <em>optional</em> the Exception instance, if the view is a JSP exception or Servlet exception view</li> </ul> -<p><strong>FreeMarker configuration with recent releases</strong></p> +<h2 id="freemarker-configuration-with-recent-releases">FreeMarker configuration with recent releases</h2> -<p>To configure the freemarker engine that Struts uses, just add a file <code class="highlighter-rouge">freemarker.properties</code> to the classpath. The supported properties are those that the Freemarker Configuration object expects - see the <a href="http://freemarker\.org/docs/api/freemarker/template/Configuration\.html\#setSetting(java\.lang\.String,%20java\.lang\.String)">Freemarker documentation</a>^[http://freemarker.org/docs/api/freemarker/template/Configuration.html#setSetting( [...] +<p>To configure the freemarker engine that Struts uses, just add a file <code class="highlighter-rouge">freemarker.properties</code> to the classpath. The supported properties +are those that the Freemarker Configuration object expects - see the <a href="https://freemarker.apache.org/docs/api/freemarker/template/Configuration.html#setSetting-java.lang.String-java.lang.String-">Freemarker documentation</a> +for these.</p> <div class="highlighter-rouge"><pre class="highlight"><code>default_encoding=ISO-8859-1 template_update_delay=5 locale=no_NO - </code></pre> </div> -<p><strong>Using struts UI tags - or any JSP Tag Library</strong></p> +<h2 id="using-struts-ui-tags---or-any-jsp-tag-library">Using struts UI tags - or any JSP Tag Library</h2> <p>Freemarker has builtin support for using any JSP taglib. You can use JSP taglibs in FreeMarker even if - a) your servlet container has no support for JSP, or - b) you didn’t specify the taglib in your web.xml - note how in the example below we refer to the taglib by its webapp-absolute URL, so no configuration in web.xml is needed.</p> + - your servlet container has no support for JSP, or + - you didn’t specify the taglib in your web.xml - note how in the example below we refer to the taglib by its webapp-absolute URL, + so no configuration in web.xml is needed.</p> <pre><code class="language-ftl"><#assign s=JspTaglibs["/WEB-INF/struts.tld"] /> @@ -231,9 +211,10 @@ locale=no_NO </code></pre> -<p>NOTE : numeric properties for tags MUST be numbers, not strings. as in the rows and cols properties above. if you use cols=”40” you will receive an exception. Other than that, the freemarker tag container behaves as you would expect.</p> +<p><em>NOTE</em>: numeric properties for tags MUST be numbers, not strings. as in the rows and cols properties above. if you use <code class="highlighter-rouge">cols="40"</code> you will +receive an exception. Other than that, the freemarker tag container behaves as you would expect.</p> -<p><strong>Dynamic attributes support</strong></p> +<h2 id="dynamic-attributes-support">Dynamic attributes support</h2> <p>You can specify dynamic attributes with Struts 2 tags like this:</p>