http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/freemarker.html ---------------------------------------------------------------------- diff --git a/content/docs/freemarker.html b/content/docs/freemarker.html index 15d5676..d509088 100644 --- a/content/docs/freemarker.html +++ b/content/docs/freemarker.html @@ -34,20 +34,6 @@ under the License. color: #666; } </style> - <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> - <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> - <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> - <script type="text/javascript"> - SyntaxHighlighter.defaults['toolbar'] = false; - SyntaxHighlighter.all(); - </script> <script type="text/javascript" language="javascript"> var hide = null; var show = null; @@ -139,24 +125,10 @@ under the License. <div class="pagecontent"> <div class="wiki-content"> - <div id="ConfluenceContent"><p><style type="text/css">/*<![CDATA[*/ -div.rbtoc1499928275070 {padding: 0px;} -div.rbtoc1499928275070 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1499928275070 li {margin-left: 0px;padding-left: 0px;} - -/*]]>*/</style></p><div class="toc-macro rbtoc1499928275070"> -<ul class="toc-indentation"><li><a shape="rect" href="#FreeMarker-GettingStarted">Getting Started</a></li><li><a shape="rect" href="#FreeMarker-Servlet/JSPScopedObjects">Servlet / JSP Scoped Objects</a> -<ul class="toc-indentation"><li><a shape="rect" href="#FreeMarker-ApplicationScopeAttribute">Application Scope Attribute</a></li><li><a shape="rect" href="#FreeMarker-SessionScopeAttribute">Session Scope Attribute</a></li><li><a shape="rect" href="#FreeMarker-RequestScopeAttribute">Request Scope Attribute</a></li><li><a shape="rect" href="#FreeMarker-RequestParameter">Request Parameter</a></li><li><a shape="rect" href="#FreeMarker-Contextparameter">Context parameter</a></li></ul> -</li><li><a shape="rect" href="#FreeMarker-TemplateLoading">Template Loading</a></li><li><a shape="rect" href="#FreeMarker-VariableResolution">Variable Resolution</a></li><li><a shape="rect" href="#FreeMarker-TagSupport">Tag Support</a></li><li><a shape="rect" href="#FreeMarker-TipsandTricks">Tips and Tricks</a> -<ul class="toc-indentation"><li><a shape="rect" href="#FreeMarker-TypeConversionandLocales">Type Conversion and Locales</a></li><li><a shape="rect" href="#FreeMarker-Extending">Extending</a></li><li><a shape="rect" href="#FreeMarker-ObjectWrapperSettings">ObjectWrapper Settings</a></li><li><a shape="rect" href="#FreeMarker-SyntaxNotes">Syntax Notes</a></li><li><a shape="rect" href="#FreeMarker-Cache">Cache</a></li><li><a shape="rect" href="#FreeMarker-IncompatibleImprovements">Incompatible Improvements</a></li></ul> -</li><li><a shape="rect" href="#FreeMarker-Next:">Next: FreeMarker Tags</a></li></ul> -</div><p>FreeMarker is a Java-based template engine that is a great alternative to <a shape="rect" href="jsp.html">JSP</a>. FreeMarker is ideal for situations where your action results can possibly be loaded from outside a Servlet container. For example, if you wished to support plugins in your application, you might wish to use FreeMarker so that the plugins could provide the entire action class and view in a single jar that is loaded from the classloader.</p><p>For more information on FreeMarker itself, please visit the <a shape="rect" class="external-link" href="http://freemarker.sourceforge.net/" rel="nofollow">FreeMarker website</a>.</p><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>The framework utilizes FreeMarker because the engine includes strong error reporting, built-in internationalization and p owerful macro libraries.</p><p>Support is also included for <a shape="rect" href="velocity.html">Velocity</a> templates. For a comparison of Velocity vs FreeMarker see <a shape="rect" class="external-link" href="http://freemarker.org/fmVsVel.html" rel="nofollow">here</a>.</p></div></div><h2 id="FreeMarker-GettingStarted">Getting Started</h2><p>Getting started with FreeMarker is as simple as ensuring all the dependencies are included in your project's classpath. Typically, the only dependency is <code>freemarker.jar</code>. Other than that, <a shape="rect" href="struts-defaultxml.html">struts-default.xml</a> already configures the <a shape="rect" href="freemarker-result.html">FreeMarker Result</a> needed to process your application's templates.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>struts.xml</b></div><div class="codeContent panelContent pdl"> -<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><action name="test" class="com.acme.TestAction"> + <div id="ConfluenceContent"><p>FreeMarker is a Java-based template engine that is a great alternative to <a shape="rect" href="jsp.html">JSP</a>. FreeMarker is ideal for situations where your action results can possibly be loaded from outside a Servlet container. For example, if you wished to support plugins in your application, you might wish to use FreeMarker so that the plugins could provide the entire action class and view in a single jar that is loaded from the classloader.</p><p>For more information on FreeMarker itself, please visit the <a shape="rect" class="external-link" href="http://freemarker.sourceforge.net/" rel="nofollow">FreeMarker website</a>.</p><rich-text-body><p>The framework utilizes FreeMarker because the engine includes strong error reporting, built-in internationalization and powerful macro libraries.</p><p>Support is also included for <a shape="rect" href="velocity.html">Velocity</a> templates. For a comparison of Velocity vs FreeMarker see <a sh ape="rect" class="external-link" href="http://freemarker.org/fmVsVel.html" rel="nofollow">here</a>.</p></rich-text-body><h2 id="FreeMarker-GettingStarted">Getting Started</h2><p>Getting started with FreeMarker is as simple as ensuring all the dependencies are included in your project's classpath. Typically, the only dependency is <code>freemarker.jar</code>. Other than that, <a shape="rect" href="struts-defaultxml.html">struts-default.xml</a> already configures the <a shape="rect" href="freemarker-result.html">FreeMarker Result</a> needed to process your application's templates.</p><parameter ac:name="title">struts.xml</parameter><parameter ac:name="">xml</parameter><plain-text-body><action name="test" class="com.acme.TestAction"> <result name="success" type="freemarker">test-success.ftl</result> </action> -</pre> -</div></div><p>Then in <code>test-success.ftl</code>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>test-success.ftl</b></div><div class="codeContent panelContent pdl"> -<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><html> +</plain-text-body><p>Then in <code>test-success.ftl</code>:</p><parameter ac:name="title">test-success.ftl</parameter><parameter ac:name="">xml</parameter><plain-text-body><html> <head> <title>Hello</title> </head> @@ -166,77 +138,38 @@ Hello, ${name} </body> </html> -</pre> -</div></div><p>Where <code>name</code> is a property on your action. That's it! Read the rest of this document for details on how templates are loaded, variables are resolved, and tags can be used.</p><h2 id="FreeMarker-Servlet/JSPScopedObjects">Servlet / JSP Scoped Objects</h2><p>The following are ways to obtained Application scope attributes, Session scope attributes, Request scope attributes, Request parameters, and framework Context scope parameters:-</p><h3 id="FreeMarker-ApplicationScopeAttribute">Application Scope Attribute</h3><p>Assuming there's an attribute with name <code>myApplicationAttribute</code> in the Application scope.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><#if Application.myApplicationAttribute?exists> +</plain-text-body><p>Where <code>name</code> is a property on your action. That's it! Read the rest of this document for details on how templates are loaded, variables are resolved, and tags can be used.</p><h2 id="FreeMarker-Servlet/JSPScopedObjects">Servlet / JSP Scoped Objects</h2><p>The following are ways to obtained Application scope attributes, Session scope attributes, Request scope attributes, Request parameters, and framework Context scope parameters:-</p><h3 id="FreeMarker-ApplicationScopeAttribute">Application Scope Attribute</h3><p>Assuming there's an attribute with name <code>myApplicationAttribute</code> in the Application scope.</p><plain-text-body><#if Application.myApplicationAttribute?exists> ${Application.myApplicationAttribute} </#if> -</pre> -</div></div><p>or</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><@s.property value="%{#application.myApplicationAttribute}" /> -</pre> -</div></div><h3 id="FreeMarker-SessionScopeAttribute">Session Scope Attribute</h3><p>Assuming there's an attribute with name <code>mySessionAttribute</code> in the Session scope.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><#if Session.mySessionAttribute?exists> +</plain-text-body><p>or</p><plain-text-body><@s.property value="%{#application.myApplicationAttribute}" /> +</plain-text-body><h3 id="FreeMarker-SessionScopeAttribute">Session Scope Attribute</h3><p>Assuming there's an attribute with name <code>mySessionAttribute</code> in the Session scope.</p><plain-text-body><#if Session.mySessionAttribute?exists> ${Session.mySessionAttribute} </#if> -</pre> -</div></div><p>or</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><@s.property value="%{#session.mySessionAttribute}" /> -</pre> -</div></div><h3 id="FreeMarker-RequestScopeAttribute">Request Scope Attribute</h3><p>Assuming there's an attribute with name 'myRequestAttribute' in the Request scope.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><#if Request.myRequestAttribute?exists> +</plain-text-body><p>or</p><plain-text-body><@s.property value="%{#session.mySessionAttribute}" /> +</plain-text-body><h3 id="FreeMarker-RequestScopeAttribute">Request Scope Attribute</h3><p>Assuming there's an attribute with name 'myRequestAttribute' in the Request scope.</p><plain-text-body><#if Request.myRequestAttribute?exists> ${Request.myRequestAttribute} </#if> -</pre> -</div></div><p>or</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><@s.property value="%{#request.myRequestAttribute}" /> -</pre> -</div></div><h3 id="FreeMarker-RequestParameter">Request Parameter</h3><p>Assuming there's a request parameter myParameter (eg. <a shape="rect" class="external-link" href="http://host/myApp/myAction.action?myParameter=one" rel="nofollow">http://host/myApp/myAction.action?myParameter=one</a>).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><#if Parameters.myParameter?exists> +</plain-text-body><p>or</p><plain-text-body><@s.property value="%{#request.myRequestAttribute}" /> +</plain-text-body><h3 id="FreeMarker-RequestParameter">Request Parameter</h3><p>Assuming there's a request parameter myParameter (eg. <a shape="rect" class="external-link" href="http://host/myApp/myAction.action?myParameter=one" rel="nofollow">http://host/myApp/myAction.action?myParameter=one</a>).</p><plain-text-body><#if Parameters.myParameter?exists> ${Parameters.myParameter} </#if> -</pre> -</div></div><p>or</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><@s.property value="%{#parameters.myParameter}" /> -</pre> -</div></div><h3 id="FreeMarker-Contextparameter">Context parameter</h3><p>Assuming there's a parameter with the name myContextParam in framework context.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">${stack.findValue('#myContextParam')} -</pre> -</div></div><p>or</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><@s.property value="%{#myContextParam}" /> -</pre> -</div></div><h2 id="FreeMarker-TemplateLoading">Template Loading</h2><p>The framework looks for FreeMarker templates in two locations (in this order):</p><ol><li>Web application</li><li>Class path</li></ol><p>This ordering makes it ideal for providing templates inside a fully-built jar, but allowing for overrides of those templates to be defined in your web application. In fact, this is how you can override the default UI tags and <a shape="rect" href="form-tags.html">Form Tags</a> included with the framework.</p><p>In addition, you can specify a location (directory on your file system) through the <code>templatePath</code> or <code>TemplatePath</code> context variable (in the <code>web.xml</code>). If a variable is specified, the content of the directory it points to will be searched first.</p><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="con fluence-information-macro-body"><p>This variable is currently NOT relative to the root of your application.</p></div></div><h2 id="FreeMarker-VariableResolution">Variable Resolution</h2><p>When using FreeMarker with the framework, variables are looked up in several different places, in this order:</p><ol><li>Built-in variables</li><li>Value stack</li><li>Action context</li><li>Request scope</li><li>Session scope</li><li>Application scope</li></ol><p>Note that the action context is looked up after the value stack. This means that you can reference the variable without the typical preceding has marker (#) like you would have to when using the JSP <code>s:property</code> tag. This is a nice convenience, though be careful because there is a small chance it could trip you up.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><@s.url id="url" value="http://www.yahoo.com"/> +</plain-text-body><p>or</p><plain-text-body><@s.property value="%{#parameters.myParameter}" /> +</plain-text-body><h3 id="FreeMarker-Contextparameter">Context parameter</h3><p>Assuming there's a parameter with the name myContextParam in framework context.</p><plain-text-body>${stack.findValue('#myContextParam')} +</plain-text-body><p>or</p><plain-text-body><@s.property value="%{#myContextParam}" /> +</plain-text-body><h2 id="FreeMarker-TemplateLoading">Template Loading</h2><p>The framework looks for FreeMarker templates in two locations (in this order):</p><ol><li>Web application</li><li>Class path</li></ol><p>This ordering makes it ideal for providing templates inside a fully-built jar, but allowing for overrides of those templates to be defined in your web application. In fact, this is how you can override the default UI tags and <a shape="rect" href="form-tags.html">Form Tags</a> included with the framework.</p><p>In addition, you can specify a location (directory on your file system) through the <code>templatePath</code> or <code>TemplatePath</code> context variable (in the <code>web.xml</code>). If a variable is specified, the content of the directory it points to will be searched first.</p><rich-text-body><p>This variable is currently NOT relative to the root of your application.</p></rich-text-body><h2 id="FreeMarker-VariableResolution">Variable Resolution</h2><p>When us ing FreeMarker with the framework, variables are looked up in several different places, in this order:</p><ol><li>Built-in variables</li><li>Value stack</li><li>Action context</li><li>Request scope</li><li>Session scope</li><li>Application scope</li></ol><p>Note that the action context is looked up after the value stack. This means that you can reference the variable without the typical preceding has marker (#) like you would have to when using the JSP <code>s:property</code> tag. This is a nice convenience, though be careful because there is a small chance it could trip you up.</p><parameter ac:name="">xml</parameter><plain-text-body><@s.url id="url" value="http://www.yahoo.com"/> Click <a xhref="${url}">here</a>! -</pre> -</div></div><p>The built-in variables that Struts-FreeMarker integration provides are:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>stack</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The value stack itself, useful for calls like ${stack.findString('ognl expr')}</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>action</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The action most recently executed</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>response</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The HttpServletResponse</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>res</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Same as response</p></td></tr><tr ><td colspan="1" rowspan="1" class="confluenceTd"><p>request</p></td><td >colspan="1" rowspan="1" class="confluenceTd"><p>The >HttpServletRequest</p></td></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p>req</p></td><td colspan="1" rowspan="1" >class="confluenceTd"><p>Same as request</p></td></tr><tr><td colspan="1" >rowspan="1" class="confluenceTd"><p>session</p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p>The HttpSession</p></td></tr><tr><td >colspan="1" rowspan="1" class="confluenceTd"><p>application</p></td><td >colspan="1" rowspan="1" class="confluenceTd"><p>The >ServletContext</p></td></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p>base</p></td><td colspan="1" rowspan="1" >class="confluenceTd"><p>The request's context >path</p></td></tr></tbody></table></div><h2 id="FreeMarker-TagSupport">Tag >Support</h2><p>FreeMarker includes complete tag support. See the <a >shape="rect" href="freemarker-tags.html">FreeMarker Tags</a> documentation >for information o n how to use the generic <a shape="rect" href="struts-tags.html">Struts Tags</a> provided by Struts. In addition to this, you can use any JSP tag, like so:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><#assign mytag=JspTaglibs["/WEB-INF/mytag.tld"]> +</plain-text-body><p>The built-in variables that Struts-FreeMarker integration provides are:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>stack</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The value stack itself, useful for calls like ${stack.findString('ognl expr')}</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>action</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The action most recently executed</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>response</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The HttpServletResponse</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>res</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Same as response</p></td></ tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>request</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The HttpServletRequest</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>req</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Same as request</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>session</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The HttpSession</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>application</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The ServletContext</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>base</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The request's context path</p></td></tr></tbody></table></div><h2 id="FreeMarker-TagSupport">Tag Support</h2><p>FreeMarker includes complete tag support. See the <a shape="rect" href="freemarker-tags.html">FreeMarker Tags</a> documentation for informa tion on how to use the generic <a shape="rect" href="struts-tags.html">Struts Tags</a> provided by Struts. In addition to this, you can use any JSP tag, like so:</p><parameter ac:name="">xml</parameter><plain-text-body><#assign mytag=JspTaglibs["/WEB-INF/mytag.tld"]> <@mytag.tagx attribute1="some ${value}"/> -</pre> -</div></div><p>Where <strong>mytag.tld</strong> is the JSP Tag Library Definition file for your tag library. Note: in order to use this support in FreeMarker, you must enable the <code>JSPSupportServlet</code> in <code>web.xml</code>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Adding JspSupportSerlvet to web.xml</b></div><div class="codeContent panelContent pdl"> -<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><servlet> +</plain-text-body><p>Where <strong>mytag.tld</strong> is the JSP Tag Library Definition file for your tag library. Note: in order to use this support in FreeMarker, you must enable the <code>JSPSupportServlet</code> in <code>web.xml</code>:</p><parameter ac:name="title">Adding JspSupportSerlvet to web.xml</parameter><parameter ac:name="">xml</parameter><plain-text-body><servlet> <servlet-name>JspSupportServlet</servlet-name> <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> -</pre> -</div></div><h2 id="FreeMarker-TipsandTricks">Tips and Tricks</h2><p>There are some advanced features that may be useful when building Struts applications with FreeMarker.</p><h3 id="FreeMarker-TypeConversionandLocales">Type Conversion and Locales</h3><p>FreeMarker has built in support for formatting dates and numbers. The formatting rules are based on the locale associated with the action request, which is by default set in <a shape="rect" href="strutsproperties.html">struts.properties</a> but can be over-ridden using the <a shape="rect" href="i18n-interceptor.html">I18n Interceptor</a>. This is normally perfect for your needs, but it is important to remember that these formatting rules are handled by FreeMarker and not by the framework's <a shape="rect" href="type-conversion.html">Type Conversion</a> support.</p><p>If you want the framework to handle the formatting according to the <a shape="rect" href="type-conversion.html">Type Conversion</a> you have specified, you shouldn't us e the normal ${...} syntax. Instead, you should use the <a shape="rect" href="property.html">property</a> tag. The difference is that the property tag is specifically designed to take an <a shape="rect" href="ognl.html">OGNL</a> expression, evaluate it, and then convert it to a String using any <a shape="rect" href="type-conversion.html">Type Conversion</a> rules you have specified. The normal ${...} syntax will use a FreeMarker expression language, evaluate it, and then convert it to a String using the built in formatting rules.</p><p><img class="emoticon emoticon-warning" src="https://cwiki.apache.org/confluence/s/en_GB/5997/6f42626d00e36f53fe51440403446ca61552e2a2.1/_/images/icons/emoticons/warning.png" data-emoticon-name="warning" alt="(warning)"> The difference in how type conversion is handled under Freemarker is subtle but important to understand.</p><h3 id="FreeMarker-Extending">Extending</h3><p>Sometimes you may with to extend the framework's FreeMarker support. For example , you might want to extend the Struts tags that come bundled with the framework.</p><p>To extend the Freemarker support, develop a class that extends <code>org.apache.struts2.views.freemarker.FreemarkerManager</code>, overriding methods as needed, and plugin the class through the <a shape="rect" href="strutsproperties.html">struts.properties</a>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: plain; gutter: false; theme: Default" style="font-size:12px;">struts.freemarker.manager.classname = com.yourcompany.YourFreeMarkerManager -</pre> -</div></div><h3 id="FreeMarker-ObjectWrapperSettings">ObjectWrapper Settings</h3><p>Once you get familiar with FreeMarker, you will find certain <em>subtleties</em>with it that may become frustrating. The most common thing you'll likely run in to is the BeansWrapper provided by FreeMarker. If you don't know what this is, don't worry. However, if you do, know this:</p><p></p><p> -The StrutsBeanWrapper extends the default FreeMarker BeansWrapper and provides almost no change in functionality, -<b>except</b> for how it handles maps. Normally, FreeMarker has two modes of operation: either support for friendly -map built-ins (?keys, ?values, etc) but only support for String keys; OR no special built-in support (ie: ?keys -returns the methods on the map instead of the keys) but support for String and non-String keys alike. Struts -provides an alternative implementation that gives us the best of both worlds. -</p> - -<p></p><p> It is possible that this special behavior may be confusing or can cause problems. Therefore, you can set the -<b>struts.freemarker.wrapper.altMap</b> property in struts.properties to false, allowing the normal BeansWrapper -logic to take place instead. -</p><h3 id="FreeMarker-SyntaxNotes">Syntax Notes</h3><p>As of FreeMarker 2.3.4, an alternative syntax is supported. This alternative syntax is great if you find that your IDE (especially IntelliJ IDEA) makes it difficult to work with the default syntax. You can read more about this syntax <a shape="rect" class="external-link" href="http://freemarker.sourceforge.net/docs/dgui_misc_alternativesyntax.html" rel="nofollow">here</a>.</p><h3 id="FreeMarker-Cache">Cache</h3><p>You can enable FreeMarker cache mechanism by specifying below options in struts.xml:</p><ul><li><code><constant name="struts.freemarker.mru.max.strong.size" value="250" /></code> - this option will be used by <a shape="rect" class="external-link" href="http://freemarker.org/docs/api/freemarker/cache/MruCacheStorage.html" rel="nofollow">freemarker.cache.MruCacheStorage</a></li></ul><ul><li><code><constant name="struts.freemarker.templatesCache.updateDelay" value="1800" /></code> - default update cache inter val (5 seconds)</li></ul><ul><li><code><constant name="struts.freemarker.templatesCache" value="true" /></code> - *<strong>DEPRECATED</strong>* this option will use a internal ConcurrentHashMap in FreemarkerTemplateEngine but not freemarker native cache</li></ul><p>Setting <code>devMode</code> to true will disable cache and updateDelay immediately, but you can explicit specify these constants to enable cache even in <code>devMode</code>, see <a shape="rect" href="devmode.html">devMode</a></p><h3 id="FreeMarker-IncompatibleImprovements">Incompatible Improvements</h3><p>By default Struts is using FreeMarker in way to be backward compatible as much as possible but if you need to enable new features you can do it via <code>freemarker.properties</code> by defining <a shape="rect" class="external-link" href="http://freemarker.org/docs/pgui_config_incompatible_improvements.html#pgui_config_incompatible_improvements_how_to_set" rel="nofollow">incompatible improvements</a> se ttings, ie.:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>freemarker.properties</b></div><div class="codeContent panelContent pdl"> -<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">incompatible_improvements=2.3.22</pre> -</div></div><p>This can impact your freemarker powered pages and Struts tags as well, so please careful test this change.</p><h2 id="FreeMarker-Next:">Next: <a shape="rect" href="freemarker-tags.html">FreeMarker Tags</a></h2></div> +</plain-text-body><h2 id="FreeMarker-TipsandTricks">Tips and Tricks</h2><p>There are some advanced features that may be useful when building Struts applications with FreeMarker.</p><h3 id="FreeMarker-TypeConversionandLocales">Type Conversion and Locales</h3><p>FreeMarker has built in support for formatting dates and numbers. The formatting rules are based on the locale associated with the action request, which is by default set in <a shape="rect" href="strutsproperties.html">struts.properties</a> but can be over-ridden using the <a shape="rect" href="i18n-interceptor.html">I18n Interceptor</a>. This is normally perfect for your needs, but it is important to remember that these formatting rules are handled by FreeMarker and not by the framework's <a shape="rect" href="type-conversion.html">Type Conversion</a> support.</p><p>If you want the framework to handle the formatting according to the <a shape="rect" href="type-conversion.html">Type Conversion</a> you have specified, you should n't use the normal ${...} syntax. Instead, you should use the <a shape="rect" href="property.html">property</a> tag. The difference is that the property tag is specifically designed to take an <a shape="rect" href="ognl.html">OGNL</a> expression, evaluate it, and then convert it to a String using any <a shape="rect" href="type-conversion.html">Type Conversion</a> rules you have specified. The normal ${...} syntax will use a FreeMarker expression language, evaluate it, and then convert it to a String using the built in formatting rules.</p><p><img class="emoticon emoticon-warning" src="https://cwiki.apache.org/confluence/s/en_GB/5997/6f42626d00e36f53fe51440403446ca61552e2a2.1/_/images/icons/emoticons/warning.png" data-emoticon-name="warning" alt="(warning)"> The difference in how type conversion is handled under Freemarker is subtle but important to understand.</p><h3 id="FreeMarker-Extending">Extending</h3><p>Sometimes you may with to extend the framework's FreeMarker support. For e xample, you might want to extend the Struts tags that come bundled with the framework.</p><p>To extend the Freemarker support, develop a class that extends <code>org.apache.struts2.views.freemarker.FreemarkerManager</code>, overriding methods as needed, and plugin the class through the <a shape="rect" href="strutsproperties.html">struts.properties</a>:</p><parameter ac:name="">none</parameter><plain-text-body>struts.freemarker.manager.classname = com.yourcompany.YourFreeMarkerManager +</plain-text-body><h3 id="FreeMarker-ObjectWrapperSettings">ObjectWrapper Settings</h3><p>Once you get familiar with FreeMarker, you will find certain <em>subtleties</em>with it that may become frustrating. The most common thing you'll likely run in to is the BeansWrapper provided by FreeMarker. If you don't know what this is, don't worry. However, if you do, know this:<parameter ac:name="atlassian-macro-output-type">INLINE</parameter><plain-text-body>{snippet:id=javadoc|javadoc=true|url=org.apache.struts2.views.freemarker.StrutsBeanWrapper}</plain-text-body></p><h3 id="FreeMarker-SyntaxNotes">Syntax Notes</h3><p>As of FreeMarker 2.3.4, an alternative syntax is supported. This alternative syntax is great if you find that your IDE (especially IntelliJ IDEA) makes it difficult to work with the default syntax. You can read more about this syntax <a shape="rect" class="external-link" href="http://freemarker.sourceforge.net/docs/dgui_misc_alternativesyntax.html" rel="nofollow">here</a>.< /p><h3 id="FreeMarker-Cache">Cache</h3><p>You can enable FreeMarker cache mechanism by specifying below options in struts.xml:</p><ul><li><code><constant name="struts.freemarker.mru.max.strong.size" value="250" /></code> - this option will be used by <a shape="rect" class="external-link" href="http://freemarker.org/docs/api/freemarker/cache/MruCacheStorage.html" rel="nofollow">freemarker.cache.MruCacheStorage</a></li></ul><ul><li><code><constant name="struts.freemarker.templatesCache.updateDelay" value="1800" /></code> - default update cache interval (5 seconds)</li></ul><ul><li><code><constant name="struts.freemarker.templatesCache" value="true" /></code> - *<strong>DEPRECATED</strong>* this option will use a internal ConcurrentHashMap in FreemarkerTemplateEngine but not freemarker native cache</li></ul><p>Setting <code>devMode</code> to true will disable cache and updateDelay immediately, but you can explicit specify these constants to enable cache even in <code> devMode</code>, see <a shape="rect" href="devmode.html">devMode</a></p><h3 id="FreeMarker-IncompatibleImprovements">Incompatible Improvements</h3><p>By default Struts is using FreeMarker in way to be backward compatible as much as possible but if you need to enable new features you can do it via <code>freemarker.properties</code> by defining <a shape="rect" class="external-link" href="http://freemarker.org/docs/pgui_config_incompatible_improvements.html#pgui_config_incompatible_improvements_how_to_set" rel="nofollow">incompatible improvements</a> settings, ie.:</p><parameter ac:name="title">freemarker.properties</parameter><plain-text-body>incompatible_improvements=2.3.22</plain-text-body><p>You can also pass this setting via <code>ServletContext</code> <code><init-param/> (since Struts 2.5.13):</code></p><parameter ac:name="">xml</parameter><plain-text-body><init-param> + <param-name>freemarker.incompatible_improvements</param-name> + <param-value>2.3.22</param-value> +</init-param></plain-text-body><p><br clear="none">This can impact your freemarker powered pages and Struts tags as well, so please careful test this change.</p><h2 id="FreeMarker-Next:">Next: <a shape="rect" href="freemarker-tags.html">FreeMarker Tags</a></h2></div> </div>
http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/generator.html ---------------------------------------------------------------------- diff --git a/content/docs/generator.html b/content/docs/generator.html index 3acfeff..ed727f8 100644 --- a/content/docs/generator.html +++ b/content/docs/generator.html @@ -155,7 +155,7 @@ at the end of the tag.</p> <h2 id="generator-Examples">Examples</h2> <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<script class="brush: xml; gutter: false; theme: Confluence" type="syntaxhighlighter"><![CDATA[ Example One: <pre> Generate a simple iterator http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/head.html ---------------------------------------------------------------------- diff --git a/content/docs/head.html b/content/docs/head.html index fbd8ee4..1b4c238 100644 --- a/content/docs/head.html +++ b/content/docs/head.html @@ -153,7 +153,7 @@ under the License. <h2 id="head-Examples">Examples</h2> <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<script class="brush: xml; gutter: false; theme: Confluence" type="syntaxhighlighter"><![CDATA[ <head> <title>My page</title> <s:head/> http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/hidden.html ---------------------------------------------------------------------- diff --git a/content/docs/hidden.html b/content/docs/hidden.html index 0385f86..ea4c4a7 100644 --- a/content/docs/hidden.html +++ b/content/docs/hidden.html @@ -152,7 +152,7 @@ under the License. <h2 id="hidden-Examples">Examples</h2> <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<script class="brush: xml; gutter: false; theme: Confluence" type="syntaxhighlighter"><![CDATA[ <-- example one --> <s:hidden name="foo" /> <-- example two --> http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/httpheader-result.html ---------------------------------------------------------------------- diff --git a/content/docs/httpheader-result.html b/content/docs/httpheader-result.html index 11a0d6d..ceda3ec 100644 --- a/content/docs/httpheader-result.html +++ b/content/docs/httpheader-result.html @@ -146,7 +146,7 @@ This result can also be used to send an error to the client. All the parameters <h1 id="HttpHeaderResult-Parameters">Parameters</h1><p> </p><p></p><ul></ul><p></p><ul><li><b>status</b> - the http servlet response status code that should be set on a response.</li></ul><p></p><ul><li><b>parse</b> - true by default. If set to false, the headers param will not be parsed for Ognl expressions.</li></ul><p></p><ul><li><b>headers</b> - header values.</li></ul><p></p><ul><li><b>error</b> - the http servlet response error code that should be set on a response.</li></ul><p></p><ul><li><b>errorMessage</b> - error message to be set on response if 'error' is set.</li></ul> <h1 id="HttpHeaderResult-Examples">Examples</h1><p></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<script class="brush: xml; gutter: false; theme: Confluence" type="syntaxhighlighter"><![CDATA[ <result name="success" type="httpheader"> <param name="status">204</param> <param name="headers.a">a custom header value</param> http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/i18n-interceptor.html ---------------------------------------------------------------------- diff --git a/content/docs/i18n-interceptor.html b/content/docs/i18n-interceptor.html index fbb1ab7..f104889 100644 --- a/content/docs/i18n-interceptor.html +++ b/content/docs/i18n-interceptor.html @@ -34,20 +34,6 @@ under the License. color: #666; } </style> - <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> - <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> - <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> - <script type="text/javascript"> - SyntaxHighlighter.defaults['toolbar'] = false; - SyntaxHighlighter.all(); - </script> <script type="text/javascript" language="javascript"> var hide = null; var show = null; @@ -139,8 +125,7 @@ under the License. <div class="pagecontent"> <div class="wiki-content"> - <div id="ConfluenceContent"><h2 id="I18nInterceptor-Description">Description</h2><p>An interceptor that handles setting the locale specified in a session as the locale for the current action request. In addition, this interceptor will look for a specific HTTP request parameter and set the locale to whatever value is provided, it also looks for specific cookie to read locale from. This means that this interceptor can be used to allow for your application to dynamically change the locale for the user's session or, alternatively, only for the current  request. This is very useful for applications that require multi-lingual support and want the user to be able to set his or her language preference at any point. The locale parameter is removed during the execution of this interceptor, ensuring that properties aren't set on an action (such as request_locale) that have no typical corresponding setter in your action.</p><p>For example, using the default parameter name, a re quest to <strong>foo.action?request_locale=en_US</strong>, then the locale for US English is saved in the user's session and will be used for all future requests. If there is no locale set (for example with the first visit), the interceptor uses the browser locale.</p><h2 id="I18nInterceptor-Parameters">Parameters</h2><ul style="list-style-type: square;"><li><strong>parameterName</strong> (optional) - the name of the HTTP request parameter that dictates the locale to switch to and save in the session. By default this is <strong>request_locale</strong></li><li><strong>requestCookieParameterName</strong> (optional) - the name of the HTTP request parameter that dictates the locale to switch to and save in a cookie. By default this is <strong>request_cookie_locale</strong></li><li><strong>requestOnlyParameterName</strong> (optional) - the name of the HTTP request parameter that dictates the locale to switch to for the current request only, without saving it in the session. By default th is is <strong>request_only_locale</strong></li><li><strong>attributeName</strong> (optional) - the name of the session key to store the selected locale. By default this is <strong>WW_TRANS_I18N_LOCALE</strong></li><li><strong>localeStorage</strong> (optional) - the name of storage location, it can be <strong>none</strong>, <strong>session</strong> or <strong>cookie</strong>. By default this is <strong>session</strong></li></ul><h2 id="I18nInterceptor-Examples">Examples</h2><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><interceptor name="i18nCookie" class="org.apache.struts2.interceptor.I18nInterceptor"/> + <div id="ConfluenceContent"><h2 id="I18nInterceptor-Description">Description</h2><p>An interceptor that handles setting the locale specified in a session as the locale for the current action request. In addition, this interceptor will look for a specific HTTP request parameter and set the locale to whatever value is provided, it also looks for specific cookie to read locale from. This means that this interceptor can be used to allow for your application to dynamically change the locale for the user's session or, alternatively, only for the current  request. This is very useful for applications that require multi-lingual support and want the user to be able to set his or her language preference at any point. The locale parameter is removed during the execution of this interceptor, ensuring that properties aren't set on an action (such as request_locale) that have no typical corresponding setter in your action.</p><p>For example, using the default parameter name, a re quest to <strong>foo.action?request_locale=en_US</strong>, then the locale for US English is saved in the user's session and will be used for all future requests. If there is no locale set (for example with the first visit), the interceptor uses the browser locale.</p><h2 id="I18nInterceptor-Parameters">Parameters</h2><ul style="list-style-type: square;"><li><strong>parameterName</strong> (optional) - the name of the HTTP request parameter that dictates the locale to switch to and save in the session. By default this is <strong>request_locale</strong></li><li><strong>requestCookieParameterName</strong> (optional) - the name of the HTTP request parameter that dictates the locale to switch to and save in a cookie. By default this is <strong>request_cookie_locale</strong></li><li><strong>requestOnlyParameterName</strong> (optional) - the name of the HTTP request parameter that dictates the locale to switch to for the current request only, without saving it in the session. By default th is is <strong>request_only_locale</strong></li><li><strong>attributeName</strong> (optional) - the name of the session key to store the selected locale. By default this is <strong>WW_TRANS_I18N_LOCALE</strong></li><li><strong>localeStorage</strong> (optional) - the name of storage location, it can be <strong>none</strong>, <strong>session</strong> or <strong>cookie</strong>. By default this is <strong>session</strong></li></ul><h2 id="I18nInterceptor-Examples">Examples</h2><parameter ac:name="">xml</parameter><plain-text-body><interceptor name="i18nCookie" class="org.apache.struts2.interceptor.I18nInterceptor"/> <action name="someAction" class="com.examples.SomeAction"> <interceptor-ref name="i18nCookie"> @@ -148,8 +133,7 @@ under the License. </interceptor-ref> <interceptor-ref name="basicStack"/> <result name="success">good_result.ftl</result> -</action></pre> -</div></div><p> </p><p> </p></div> +</action></plain-text-body><p> </p><p> </p></div> </div> http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/i18n.html ---------------------------------------------------------------------- diff --git a/content/docs/i18n.html b/content/docs/i18n.html index 9f5df64..b30bfc8 100644 --- a/content/docs/i18n.html +++ b/content/docs/i18n.html @@ -156,7 +156,7 @@ associated with the current action.</p> <h1 id="i18n-Examples">Examples</h1> <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<script class="brush: xml; gutter: false; theme: Confluence" type="syntaxhighlighter"><![CDATA[ <s:i18n name="myCustomBundle"> The i18n value for key aaa.bbb.ccc in myCustomBundle is <s:property value="text('aaa.bbb.ccc')" /> http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/if.html ---------------------------------------------------------------------- diff --git a/content/docs/if.html b/content/docs/if.html index 57df817..b72a9bd 100644 --- a/content/docs/if.html +++ b/content/docs/if.html @@ -34,20 +34,6 @@ under the License. color: #666; } </style> - <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> - <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> - <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> - <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> - <script type="text/javascript"> - SyntaxHighlighter.defaults['toolbar'] = false; - SyntaxHighlighter.all(); - </script> <script type="text/javascript" language="javascript"> var hide = null; var show = null; @@ -139,7 +125,7 @@ under the License. <div class="pagecontent"> <div class="wiki-content"> - <div id="ConfluenceContent"><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Please make sure you have read the <a shape="rect" href="tag-syntax.html">Tag Syntax</a> document and understand how tag attribute syntax works.</p></div></div> + <div id="ConfluenceContent"><rich-text-body><p>Please make sure you have read the <a shape="rect" href="tag-syntax.html">Tag Syntax</a> document and understand how tag attribute syntax works.</p></rich-text-body> <h2 id="if-Description">Description</h2> @@ -147,23 +133,11 @@ under the License. <h2 id="if-Parameters">Parameters</h2> -<p><table width="100%"><tr><td colspan="6" rowspan="1"><h4>Dynamic Attributes Allowed:</h4> false</td></tr><tr><td colspan="6" rowspan="1"> </td></tr><tr><th align="left" colspan="1" rowspan="1" valign="top"><h4>Name</h4></th><th align="left" colspan="1" rowspan="1" valign="top"><h4>Required</h4></th><th align="left" colspan="1" rowspan="1" valign="top"><h4>Default</h4></th><th align="left" colspan="1" rowspan="1" valign="top"><h4>Evaluated</h4></th><th align="left" colspan="1" rowspan="1" valign="top"><h4>Type</h4></th><th align="left" colspan="1" rowspan="1" valign="top"><h4>Description</h4></th></tr><tr><td align="left" colspan="1" rowspan="1" valign="top">test</td><td align="left" colspan="1" rowspan="1" valign="top"><strong>true</strong></td><td align="left" colspan="1" rowspan="1" valign="top"></td><td align="left" colspan="1" rowspan="1" valign="top">false</td><td align="left" colspan="1" rowspan="1" valign="top">Boolean</td><td align="left" colspan="1" rowspan="1" valig n="top">Expression to determine if body of tag is to be displayed</td></tr></table></p> +<plain-text-body>{snippet:id=tagattributes|javadoc=false|url=struts2-tags/if.html}</plain-text-body> <h2 id="if-Examples">Examples</h2> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ -<s:if test="%{false}"> - <div>Will Not Be Executed</div> -</s:if> -<s:elseif test="%{true}"> - <div>Will Be Executed</div> -</s:elseif> -<s:else> - <div>Will Not Be Executed</div> -</s:else> -]]></script> -</div></div></div> +<plain-text-body>{snippet:id=example|lang=xml|javadoc=true|url=struts2/core/src/main/java/org/apache/struts2/components/If.java}</plain-text-body></div> </div> http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/include.html ---------------------------------------------------------------------- diff --git a/content/docs/include.html b/content/docs/include.html index 04616ea..9af44d3 100644 --- a/content/docs/include.html +++ b/content/docs/include.html @@ -159,7 +159,7 @@ a scriptlet.</p> <h2 id="include-Example">Example</h2> <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<script class="brush: java; gutter: false; theme: Confluence" type="syntaxhighlighter"><![CDATA[ <-- One: --> <s:include value="myJsp.jsp" /> @@ -177,7 +177,7 @@ a scriptlet.</p> ]]></script> </div></div> <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: plain; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<script class="brush: plain; gutter: false; theme: Confluence" type="syntaxhighlighter"><![CDATA[ Example one - do an include myJsp.jsp page Example two - do an include to myJsp.jsp page with parameters param1=value1 and param2=value2 Example three - do an include to myJsp.jsp page with parameters param1=value1 and param2=value2 http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/inputconfig-annotation.html ---------------------------------------------------------------------- diff --git a/content/docs/inputconfig-annotation.html b/content/docs/inputconfig-annotation.html index 5f03070..a4b1430 100644 --- a/content/docs/inputconfig-annotation.html +++ b/content/docs/inputconfig-annotation.html @@ -155,7 +155,7 @@ under the License. <h2 id="InputConfigAnnotation-Examples">Examples</h2> <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<script class="brush: java; gutter: false; theme: Confluence" type="syntaxhighlighter"><![CDATA[ public class SampleAction extends ActionSupport { public void isValid() throws ValidationException { http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/inputtransferselect.html ---------------------------------------------------------------------- diff --git a/content/docs/inputtransferselect.html b/content/docs/inputtransferselect.html index 6e971f7..6cbc0cb 100644 --- a/content/docs/inputtransferselect.html +++ b/content/docs/inputtransferselect.html @@ -163,7 +163,7 @@ and doubleId will be <form_id>_<inputtransferselect_doubleName> and <h2 id="inputtransferselect-Example">Example</h2> <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<script class="brush: xml; gutter: false; theme: Confluence" type="syntaxhighlighter"><![CDATA[ <-- minimum configuration --> <s:inputtransferselect http://git-wip-us.apache.org/repos/asf/struts-site/blob/b16cc4ef/content/docs/int-validator.html ---------------------------------------------------------------------- diff --git a/content/docs/int-validator.html b/content/docs/int-validator.html index 63da76e..8ca5d4f 100644 --- a/content/docs/int-validator.html +++ b/content/docs/int-validator.html @@ -153,7 +153,7 @@ using expression can be slightly slower, see the example below.</p> <h1 id="intvalidator-Examples">Examples</h1> <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<script class="brush: xml; gutter: false; theme: Confluence" type="syntaxhighlighter"><![CDATA[ <validators> <!-- Plain Validator Syntax --> <validator type="int">