Author: lukaszlenart
Date: Fri Jul 25 15:44:36 2014
New Revision: 917389
Log:
Updates production
Modified:
websites/production/struts/content/release/2.3.x/docs/file-upload.html
websites/production/struts/content/release/2.3.x/docs/objectfactory.html
websites/production/struts/content/release/2.3.x/docs/ognl.html
Modified: websites/production/struts/content/release/2.3.x/docs/file-upload.html
==============================================================================
--- websites/production/struts/content/release/2.3.x/docs/file-upload.html
(original)
+++ websites/production/struts/content/release/2.3.x/docs/file-upload.html Fri
Jul 25 15:44:36 2014
@@ -138,33 +138,19 @@ under the License.
<div class="pagecontent">
<div class="wiki-content">
- <div id="ConfluenceContent"><p>The Struts 2 framework provides
built-in support for processing file uploads that conform to <a shape="rect"
class="external-link" href="http://www.ietf.org/rfc/rfc1867.txt"
rel="nofollow">RFC 1867</a>, "Form-based File Upload in HTML". When correctly
configured the framework will pass uploaded file(s) into your Action class.
Support for individual and multiple file uploads are provided. When a file is
uploaded it will typically be stored in a temporary directory. Uploaded files
should be processed or moved by your Action class to ensure the data is not
lost. Be aware that servers may have a security policy in place that prohibits
you from writing to directories other than the temporary directory and the
directories that belong to your web application.</p>
+ <div id="ConfluenceContent"><p>The Struts 2 framework provides
built-in support for processing file uploads that conform to <a shape="rect"
class="external-link" href="http://www.ietf.org/rfc/rfc1867.txt"
rel="nofollow">RFC 1867</a>, "Form-based File Upload in HTML". When correctly
configured the framework will pass uploaded file(s) into your Action class.
Support for individual and multiple file uploads are provided. When a file is
uploaded it will typically be stored in a temporary directory. Uploaded files
should be processed or moved by your Action class to ensure the data is not
lost. Be aware that servers may have a security policy in place that prohibits
you from writing to directories other than the temporary directory and the
directories that belong to your web application.</p><p><style
type="text/css">/*<![CDATA[*/
+div.rbtoc1406303008504 {padding: 0px;}
+div.rbtoc1406303008504 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1406303008504 li {margin-left: 0px;padding-left: 0px;}
-<style type="text/css">/*<![CDATA[*/
-div.rbtoc1405758701857 {padding: 0px;}
-div.rbtoc1405758701857 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1405758701857 li {margin-left: 0px;padding-left: 0px;}
-
-/*]]>*/</style><div class="toc-macro rbtoc1405758701857">
+/*]]>*/</style></p><div class="toc-macro rbtoc1406303008504">
<ul class="toc-indentation"><li><a shape="rect"
href="#FileUpload-Dependencies">Dependencies</a></li><li><a shape="rect"
href="#FileUpload-BasicUsage">Basic Usage</a></li><li><a shape="rect"
href="#FileUpload-UploadingMultipleFiles">Uploading Multiple Files</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#FileUpload-UploadingMultipleFilesusingArrays">Uploading Multiple Files
using Arrays</a></li><li><a shape="rect"
href="#FileUpload-UploadingMultipleFilesusingLists">Uploading Multiple Files
using Lists</a></li></ul>
</li><li><a shape="rect" href="#FileUpload-AdvancedConfiguration">Advanced
Configuration</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#FileUpload-FileSizeLimits">File Size Limits</a></li><li><a shape="rect"
href="#FileUpload-FileTypes">File Types</a></li><li><a shape="rect"
href="#FileUpload-ErrorMessages">Error Messages</a></li><li><a shape="rect"
href="#FileUpload-TemporaryDirectories">Temporary Directories</a></li><li><a
shape="rect" href="#FileUpload-AlternateLibraries">Alternate
Libraries</a></li></ul>
</li></ul>
-</div>
-
-<h2 id="FileUpload-Dependencies">Dependencies</h2>
-
-<p>The Struts 2 framework leverages add-on libraries to handle the parsing of
uploaded files. These libraries are not included in the Struts distribution,
you must add them into your project. The libraries needed are:</p>
-
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p> Library </p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p> URL </p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p> Struts 2.0.x </p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p> Struts 2.1.x </p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>Commons-FileUpload </p></td><td
colspan="1" rowspan="1" class="confluenceTd"> <a shape="rect"
class="external-link"
href="http://commons.apache.org/fileupload/">http://commons.apache.org/fileupload/</a>
</td><td colspan="1" rowspan="1" class="confluenceTd"><p> 1.1.1 </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> 1.2.1 </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>Commons-IO </p></td><td
colspan="1" rowspan="1" class="confluenceTd"> <a shape="rect"
class="external-link"
href="http://commons.apache.org/io/">http://commons.apache.org/io/</a>
</td><td colspan="1" rowspan="1" class="confluenceTd"><p> 1.0 </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> 1.3.2
</p></td></tr></tbody></table></div>
-
-
-<p>If you are using Maven then you can add these libraries as dependencies in
your project's pom.xml.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Struts 2.0.x File Upload
Dependencies</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<dependency>
+</div><h2 id="FileUpload-Dependencies">Dependencies</h2><p>The Struts 2
framework leverages add-on libraries to handle the parsing of uploaded files.
These libraries are not included in the Struts distribution, you must add them
into your project. The libraries needed are:</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Library</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>URL</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Struts 2.0.x</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Struts 2.1.x</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>Commons-FileUpload</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><a shape="rect" class="external-link"
href="http://commons.apache.org/fileupload/">http://commons.apache.org/fileupload/</a></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>1.1.1</p></td><td colspan="1"
rowspan="1" class="confluenc
eTd"><p>1.2.1</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>Commons-IO</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><a shape="rect" class="external-link"
href="http://commons.apache.org/io/">http://commons.apache.org/io/</a></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>1.0</p></td><td colspan="1"
rowspan="1"
class="confluenceTd"><p>1.3.2</p></td></tr></tbody></table></div><p>If you are
using Maven then you can add these libraries as dependencies in your project's
pom.xml.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Struts
2.0.x File Upload Dependencies</b></div><div class="codeContent panelContent
pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.1.1</version>
@@ -175,11 +161,8 @@ div.rbtoc1405758701857 li {margin-left:
<version>1.0</version>
</dependency>
]]></script>
-</div></div>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Struts 2.1.x File Upload
Dependencies</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<dependency>
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Struts
2.1.x File Upload Dependencies</b></div><div class="codeContent panelContent
pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
@@ -190,39 +173,20 @@ div.rbtoc1405758701857 li {margin-left:
<version>1.3.2</version>
</dependency>
]]></script>
-</div></div>
-
-<h2 id="FileUpload-BasicUsage">Basic Usage</h2>
-
-<p>The <code>org.apache.struts2.interceptor.FileUploadInterceptor</code> class
is included as part of the <code>defaultStack</code>. As long as the required
libraries are added to your project you will be able to take advantage of of
the Struts 2 fileUpload capability. Configure an Action mapping for your Action
class as you typically would.</p>
-
-<p><strong>Example action mapping:</strong></p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<action name="doUpload"
class="com.example.UploadAction">
+</div></div><h2 id="FileUpload-BasicUsage">Basic Usage</h2><p>The
<code>org.apache.struts2.interceptor.FileUploadInterceptor</code> class is
included as part of the <code>defaultStack</code>. As long as the required
libraries are added to your project you will be able to take advantage of of
the Struts 2 fileUpload capability. Configure an Action mapping for your Action
class as you typically would.</p><p><strong>Example action
mapping:</strong></p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<action name="doUpload"
class="com.example.UploadAction">
<result name="success">good_result.jsp</result>
</action>
]]></script>
-</div></div>
-
-<p>A form must be create with a form field of type file, <code><INPUT
type="file" name="upload"></code>. The form used to upload the file must
have its encoding type set to multipart/form-data, <code><FORM
action="doUpload" enctype="multipart/form-data" method="post"></code>. The
standard procedure for adding these elements is by using the Struts 2 tag
libraries as shown in the following example:</p>
-
-<p><strong>Example JSP form tags:</strong></p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</div></div><p>A form must be create with a form field of type file,
<code><INPUT type="file" name="upload"></code>. The form used to upload
the file must have its encoding type set to multipart/form-data, <code><FORM
action="doUpload" enctype="multipart/form-data" method="post"></code>. The
standard procedure for adding these elements is by using the Struts 2 tag
libraries as shown in the following example:</p><p><strong>Example JSP form
tags:</strong></p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
<s:form action="doUpload" method="post"
enctype="multipart/form-data">
<s:file name="upload" label="File"/>
<s:submit/>
</s:form>
]]></script>
-</div></div>
-
-<p>The fileUpload interceptor will use setter injection to insert the uploaded
file and related data into your Action class. For a form field named
<strong>upload</strong> you would provide the three setter methods shown in the
following example:</p>
-
-<p><strong>Example Action class:</strong></p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-package com.example;
+</div></div><p>The fileUpload interceptor will use setter injection to insert
the uploaded file and related data into your Action class. For a form field
named <strong>upload</strong> you would provide the three setter methods shown
in the following example:</p><p><strong>Example Action class:</strong></p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[package com.example;
import java.io.File;
import com.opensymphony.xwork2.ActionSupport;
@@ -250,22 +214,7 @@ package com.example;
}
}
]]></script>
-</div></div>
-<p>The purpose of each one of these methods is described in the table below.
Notice that if you have multiple file form elements with different names you
would be required to have another corresponding set of these methods for each
file uploaded.</p>
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p> Method Signature </p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p> Description
</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
setX(File file) </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>
The file that contains the content of the uploaded file. This is a temporary
file and <code>file.getName()</code> will not return the original name of the
file </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
setXContentType(String contentType) </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> The mime type of the uploaded file
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
setXFileName(String fileName) </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> The actual file name of the uploaded file (not the
HTML name) </p></td></tr></tbody></table></div>
-
-
-<h2 id="FileUpload-UploadingMultipleFiles">Uploading Multiple Files</h2>
-
-<p>As mentioned in the previous section one technique for uploading multiple
files would be to simply have multiple form input elements of type file all
with different names. This would require a number of setter methods that was
equal to 3 times the number of files being uploaded. Another option is to use
Arrays or java.util.Lists. The following examples are taken from the Showcase
example application that is part sample applications you can download at <a
shape="rect" class="external-link"
href="http://struts.apache.org/download.cgi">http://struts.apache.org/download.cgi</a>.
For the Action mapping details see <code>struts-fileupload.xml</code> in the
sample application download.</p>
-
-<h3 id="FileUpload-UploadingMultipleFilesusingArrays">Uploading Multiple Files
using Arrays</h3>
-
-<p><strong>multipleUploadUsingArray.jsp</strong> Notice all file input types
have the same name.</p>
-<div class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
-
-<p><strong>MultipleFileUploadUsingArrayAction.java</strong></p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</div></div><p>The purpose of each one of these methods is described in the
table below. Notice that if you have multiple file form elements with different
names you would be required to have another corresponding set of these methods
for each file uploaded.</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Method Signature</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>setX(File file)</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The file that contains the content of the
uploaded file. This is a temporary file and <code>file.getName()</code> will
not return the original name of the file</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>setXContentType(String
contentType)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The
mime type of the uploaded file</p></td></tr><tr><td co
lspan="1" rowspan="1" class="confluenceTd"><p>setXFileName(String
fileName)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The
actual file name of the uploaded file (not the HTML
name)</p></td></tr></tbody></table></div><h2
id="FileUpload-UploadingMultipleFiles">Uploading Multiple Files</h2><p>As
mentioned in the previous section one technique for uploading multiple files
would be to simply have multiple form input elements of type file all with
different names. This would require a number of setter methods that was equal
to 3 times the number of files being uploaded. Another option is to use Arrays
or java.util.Lists. The following examples are taken from the Showcase example
application that is part sample applications you can download at <a
shape="rect" class="external-link"
href="http://struts.apache.org/download.cgi">http://struts.apache.org/download.cgi</a>.
For the Action mapping details see <code>struts-fileupload.xml</code> in the
sample application download.</
p><h3 id="FileUpload-UploadingMultipleFilesusingArrays">Uploading Multiple
Files using Arrays</h3><p><strong>multipleUploadUsingArray.jsp</strong> Notice
all file input types have the same name.</p><div class="error"><span
class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span>
</div><p><strong>MultipleFileUploadUsingArrayAction.java</strong></p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
package org.apache.struts2.showcase.fileupload;
@@ -328,15 +277,7 @@ public class MultipleFileUploadUsingArra
}
}
]]></script>
-</div></div>
-
-<h3 id="FileUpload-UploadingMultipleFilesusingLists">Uploading Multiple Files
using Lists</h3>
-
-<p><strong>multipleUploadUsingList.jsp</strong> Notice all file input types
have the same name.</p>
-<div class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
-
-<p><strong>MultipleFileUploadUsingListAction.java</strong></p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</div></div><h3 id="FileUpload-UploadingMultipleFilesusingLists">Uploading
Multiple Files using Lists</h3><p><strong>multipleUploadUsingList.jsp</strong>
Notice all file input types have the same name.</p><div class="error"><span
class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span>
</div><p><strong>MultipleFileUploadUsingListAction.java</strong></p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
package org.apache.struts2.showcase.fileupload;
@@ -402,31 +343,19 @@ public class MultipleFileUploadUsingList
}
}
]]></script>
-</div></div>
-
-<h2 id="FileUpload-AdvancedConfiguration">Advanced Configuration</h2>
-
-<p>The Struts 2 <code>default.properties</code> file defines several settings
that affect the behavior of file uploading. You may find in necessary to change
these values. The names and default values are:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: plain; gutter: false"
type="syntaxhighlighter"><![CDATA[
-struts.multipart.parser=jakarta
+</div></div><h2 id="FileUpload-AdvancedConfiguration">Advanced
Configuration</h2><p>The Struts 2 <code>default.properties</code> file defines
several settings that affect the behavior of file uploading. You may find in
necessary to change these values. The names and default values are:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<script class="theme: Default; brush: plain; gutter: false"
type="syntaxhighlighter"><![CDATA[struts.multipart.parser=jakarta
struts.multipart.saveDir=
struts.multipart.maxSize=2097152
]]></script>
-</div></div>
-
- <div class="aui-message warning shadowed information-macro">
+</div></div> <div class="aui-message warning shadowed information-macro">
<span class="aui-icon icon-warning">Icon</span>
<div class="message-content">
<p>Please remember that the
<strong>struts.multipart.maxSize</strong> is the size limit of the whole
request, which means when you uploading multiple files, the sum of their size
must be below the <strong>struts.multipart.maxSize</strong>!</p>
</div>
</div>
-
-
-<p>In order to change theses settings you define a constant in your
applications <code>struts.xml</code> file like so:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
+<p>In order to change theses settings you define a constant in your
applications <code>struts.xml</code> file like so:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<?xml version="1.0"
encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration
2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
@@ -435,13 +364,8 @@ struts.multipart.maxSize=2097152
...
</struts>
]]></script>
-</div></div>
-
-<p>Additionally the <code>fileUpload</code> interceptor has settings that can
be put in place for individual action mappings by customizing your interceptor
stack.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<action name="doUpload"
class="com.example.UploadAction">
+</div></div><p>Additionally the <code>fileUpload</code> interceptor has
settings that can be put in place for individual action mappings by customizing
your interceptor stack.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<action name="doUpload"
class="com.example.UploadAction">
<interceptor-ref name="basicStack"/>
<interceptor-ref name="fileUpload">
<param name="allowedTypes">text/plain</param>
@@ -452,15 +376,8 @@ struts.multipart.maxSize=2097152
<result name="success">good_result.jsp</result>
</action>
]]></script>
-</div></div>
-
-<h3 id="FileUpload-FileSizeLimits">File Size Limits</h3>
-
-<p>There are two separate file size limits. First is
<code>struts.multipart.maxSize</code> which comes from the Struts 2
<code>default.properties</code> file. This setting exists for security reasons
to prohibit a malicious user from uploading extremely large files to file up
your servers disk space. This setting defaults to approximately 2 megabytes and
should be adjusted to the maximum size file (2 gigs max) that your will need
the framework to receive. If you are uploading more than one file on a form the
<code>struts.multipart.maxSize</code> applies to the combined total, not the
individual file sizes. The other setting, <code>maximumSize</code>, is an
interceptor setting that is used to ensure a particular Action does not receive
a file that is too large. Notice the locations of both settings in the
following example:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
+</div></div><h3 id="FileUpload-FileSizeLimits">File Size Limits</h3><p>There
are two separate file size limits. First is
<code>struts.multipart.maxSize</code> which comes from the Struts 2
<code>default.properties</code> file. This setting exists for security reasons
to prohibit a malicious user from uploading extremely large files to file up
your servers disk space. This setting defaults to approximately 2 megabytes and
should be adjusted to the maximum size file (2 gigs max) that your will need
the framework to receive. If you are uploading more than one file on a form the
<code>struts.multipart.maxSize</code> applies to the combined total, not the
individual file sizes. The other setting, <code>maximumSize</code>, is an
interceptor setting that is used to ensure a particular Action does not receive
a file that is too large. Notice the locations of both settings in the
following example:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent
pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<?xml version="1.0"
encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration
2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
@@ -479,15 +396,8 @@ struts.multipart.maxSize=2097152
</action>
</struts>
]]></script>
-</div></div>
-
-<h3 id="FileUpload-FileTypes">File Types</h3>
-
-<p>There are two ways to limit the uploaded file type, declaratively and
programmatically. To declaratively limit the file type a comma separated list
of allowedTypes can be specified as a fileUpload interceptor param as shown in
the following example:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<action name="doUpload"
class="com.example.UploadAction">
+</div></div><h3 id="FileUpload-FileTypes">File Types</h3><p>There are two ways
to limit the uploaded file type, declaratively and programmatically. To
declaratively limit the file type a comma separated list of allowedTypes can be
specified as a fileUpload interceptor param as shown in the following
example:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<action name="doUpload"
class="com.example.UploadAction">
<interceptor-ref name="basicStack"/>
<interceptor-ref name="fileUpload">
<param
name="allowedTypes">image/jpeg,image/gif</param>
@@ -498,24 +408,7 @@ struts.multipart.maxSize=2097152
<result name="success">good_result.jsp</result>
</action>
]]></script>
-</div></div>
-
-<p>When the uploaded file type does not match one of the MIME types specified
a field error will be created as described in the next section entitled Error
Messages. Programmatically limiting the file type means using the information
passed in to your Action class via the <code>setXContentType(String
contentType)</code> method. The benefit to this type of approach would be that
it's more flexible and no interceptor configuration would be needed if file
sizes are keep under 2 megs.</p>
-
-<h3 id="FileUpload-ErrorMessages">Error Messages</h3>
-
-<p>If an error occurs several field errors will be added assuming that the
action implements <code>com.opensymphony.xwork2.ValidationAware</code> or
extends <code>com.opensymphony.xwork2.ActionSupport</code>. These error
messages are based on several i18n values stored in struts-messages.properties,
a default i18n file processed for all i18n requests. You can override the text
of these messages by providing text for the following keys:</p>
-
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p> Error Key </p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p> Description
</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
struts.messages.error.uploading </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> A general error that occurs when the file could not be
uploaded </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
struts.messages.error.file.too.large </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Occurs when the uploaded file is too large as
specified by maximumSize. </p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p> struts.messages.error.content.type.not.allowed
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Occurs when the
uploaded file does not match the expected content types specified
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluen
ceTd"><p> struts.messages.error.file.extension.not.allowed </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Occurs when uploaded file has
disallowed extension </p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>
struts.messages.upload.error.SizeLimitExceededException </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Occurs when the upload request
(as a whole) exceed configured <strong>struts.multipart.maxSize</strong>
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
struts.messages.upload.error.<Exception class SimpleName> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Occurs when any other
exception took place during file upload process
</p></td></tr></tbody></table></div>
-
-
-<h3 id="FileUpload-TemporaryDirectories">Temporary Directories</h3>
-
-<p>All uploaded files are saved to a temporary directory by the framework
before being passed in to an Action. Depending on the allowed file sizes it may
be necessary to have the framework store these temporary files in an alternate
location. To do this change <code>struts.multipart.saveDir</code> to the
directory where the uploaded files will be placed. If this property is not set
it defaults to <code>javax.servlet.context.tempdir</code>. Keep in mind that on
some operating systems, like Solaris, <code>/tmp</code> is memory based and
files stored in that directory would consume an amount of RAM approximately
equal to the size of the uploaded file.</p>
-
-<h3 id="FileUpload-AlternateLibraries">Alternate Libraries</h3>
-
-<p>The <code>struts.multipart.parser</code> used by the fileUpload interceptor
to handle HTTP POST requests, encoded using the MIME-type multipart/form-data,
can be changed out. Currently there are two choices, jakarta and pell. The
jakarta parser is a standard part of the Struts 2 framework needing only its
required libraries added to a project. The pell parser uses Jason Pell's
multipart parser instead of the Commons-FileUpload library. The pell parser is
a Struts 2 plugin, for more details see: <a shape="rect" class="external-link"
href="http://cwiki.apache.org/S2PLUGINS/pell-multipart-plugin.html">http://cwiki.apache.org/S2PLUGINS/pell-multipart-plugin.html</a>.
There was a third alternative, cos, but it was removed due to licensing
incompatibilities.</p></div>
+</div></div><p>When the uploaded file type does not match one of the MIME
types specified a field error will be created as described in the next section
entitled Error Messages. Programmatically limiting the file type means using
the information passed in to your Action class via the
<code>setXContentType(String contentType)</code> method. The benefit to this
type of approach would be that it's more flexible and no interceptor
configuration would be needed if file sizes are keep under 2 megs.</p><h3
id="FileUpload-ErrorMessages">Error Messages</h3><p>If an error occurs several
field errors will be added assuming that the action implements
<code>com.opensymphony.xwork2.ValidationAware</code> or extends
<code>com.opensymphony.xwork2.ActionSupport</code>. These error messages are
based on several i18n values stored in struts-messages.properties, a default
i18n file processed for all i18n requests. You can override the text of these
messages by providing text for the following keys:</p>
<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p>Error Key</p></th><th
colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>struts.messages.error.uploading</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>A general error that occurs
when the file could not be uploaded</p></td></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p>struts.messages.error.file.too.large</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Occurs when the uploaded file
is too large as specified by maximumSize.</p></td></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p>struts.messages.error.content.type.not.allowed</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Occurs when the uploaded file
does not match the expected content types specified</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>struts.
messages.error.file.extension.not.allowed</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Occurs when uploaded file has disallowed
extension</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>struts.messages.upload.error.SizeLimitExceededException</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Occurs when the upload request
(as a whole) exceed configured
<strong>struts.multipart.maxSize</strong></p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>struts.messages.upload.error.<Exception
class SimpleName></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Occurs when any other exception took place during file
upload process</p></td></tr></tbody></table></div><h3
id="FileUpload-TemporaryDirectories">Temporary Directories</h3><p>All uploaded
files are saved to a temporary directory by the framework before being passed
in to an Action. Depending on the allowed file sizes it may be necessary to
have the framework s
tore these temporary files in an alternate location. To do this change
<code>struts.multipart.saveDir</code> to the directory where the uploaded files
will be placed. If this property is not set it defaults to
<code>javax.servlet.context.tempdir</code>. Keep in mind that on some operating
systems, like Solaris, <code>/tmp</code> is memory based and files stored in
that directory would consume an amount of RAM approximately equal to the size
of the uploaded file.</p><h3 id="FileUpload-AlternateLibraries">Alternate
Libraries</h3><p>The <code>struts.multipart.parser</code> used by the
fileUpload interceptor to handle HTTP POST requests, encoded using the
MIME-type multipart/form-data, can be changed out. Currently there are two
choices, jakarta and pell. The jakarta parser is a standard part of the Struts
2 framework needing only its required libraries added to a project. The pell
parser uses Jason Pell's multipart parser instead of the Commons-FileUpload
library. The pell parser is a
Struts 2 plugin, for more details see: <a shape="rect" class="external-link"
href="http://cwiki.apache.org/S2PLUGINS/pell-multipart-plugin.html">http://cwiki.apache.org/S2PLUGINS/pell-multipart-plugin.html</a>.
There was a third alternative, cos, but it was removed due to licensing
incompatibilities.</p><p>As from Struts version 2.3.18 a new implementation
of <code>MultiPartRequest</code> was added
- <code>JakartaStreamMultiPartRequest</code>. It can be used to handle
large files, see <a shape="rect" class="external-link"
href="https://issues.apache.org/jira/browse/WW-3025">WW-3025</a> for more
details, but you can simple set</p><pre><constant
name="struts.multipart.parser" value="jakarta-stream" /></pre><p>in
struts.xml to start using it.</p></div>
</div>
Modified:
websites/production/struts/content/release/2.3.x/docs/objectfactory.html
==============================================================================
--- websites/production/struts/content/release/2.3.x/docs/objectfactory.html
(original)
+++ websites/production/struts/content/release/2.3.x/docs/objectfactory.html
Fri Jul 25 15:44:36 2014
@@ -138,46 +138,21 @@ under the License.
<div class="pagecontent">
<div class="wiki-content">
- <div id="ConfluenceContent"><p>All objects created by the
framework are instantiated by the ObjectFactory. The ObjectFactory provides the
means of integrating the framework with IoC containers like Spring, Pico,
Plexus, and so forth.</p>
-
-<h2 id="ObjectFactory-Customize">Customize</h2>
-
-<h3 id="ObjectFactory-ExtendObjectFactory">Extend ObjectFactory</h3>
- <div class="aui-message warning shadowed information-macro">
+ <div id="ConfluenceContent"><p>All objects created by the
framework are instantiated by the ObjectFactory. The ObjectFactory provides the
means of integrating the framework with IoC containers like Spring, Pico,
Plexus, and so forth.</p><h2 id="ObjectFactory-Customize">Customize</h2><h3
id="ObjectFactory-ExtendObjectFactory">Extend ObjectFactory</h3> <div
class="aui-message warning shadowed information-macro">
<span class="aui-icon icon-warning">Icon</span>
<div class="message-content">
-
-<p>Customized ObjectFactory must extend ObjectFactory or any of its
descendants and have a default, no-argument constructor.</p>
+ <p>Customized ObjectFactory must extend
ObjectFactory or any of its descendants and have a default, no-argument
constructor.</p>
</div>
</div>
-
-
-<p>To register a customized ObjectFactory, add or edit an entry in
<code>struts.properties</code></p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
- struts.objectFactory=foo.bar.MyCustomObjectFactory
+<p>To register a customized ObjectFactory, add or edit an entry in
<code>struts.properties</code></p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
struts.objectFactory=foo.bar.MyCustomObjectFactory
]]></script>
-</div></div>
-<p>where foo.bar.MyCustomObjectFactory is the custom object factory. </p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-public class MyObjectFactory extends ObjectFactory {
+</div></div><p>where foo.bar.MyCustomObjectFactory is the custom object
factory.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[public class MyObjectFactory extends
ObjectFactory {
.....
}
]]></script>
-</div></div>
-
-<h3 id="ObjectFactory-Definededicatedfactory">Define dedicated factory</h3>
-<p>If you want to just extend one part of ObjectFactory, ie. to change how <a
shape="rect" href="result-types.html">Result Types</a> are build, you can
implement <code>ResultFactory</code> interface and register it with dedicated
name, see <a shape="rect" href="plugins.html#Plugins-ExtensionPoints">Extension
Points</a> for more details. Original ObjectFactory will use these dedicated
factories to do the work. It's already done this way - the original
functionality of ObjectFactory was extracted to separated classes which
implements the interfaces below. Check the source of ObjectFactory to see more
details. All these factories are available as from version 2.3.16.</p>
-
-<p>List of Factory interfaces:</p>
-<ul class="alternate"><li><code>ResultFactory</code> - dedicated interfaces
used by <a shape="rect" href="objectfactory.html">ObjectFactory</a> to create
<a shape="rect" href="result-types.html">Result Types</a>
- <ul class="alternate"><li><code>StrutsResultFactory</code> it's
internal implementation which checks if Result implements
<code>ParamNameAwareResult</code> interface to restrict names of parameters set
on the instance of Result, see <a shape="rect" href="result-types.html">Result
Types</a> for more info.</li></ul>
- </li><li><code>ActionFactory</code> - dedicated interface used by <a
shape="rect" href="objectfactory.html">ObjectFactory</a> to
actions</li><li><code>InterceptorFactory</code> - dedicated interface used by
<a shape="rect" href="objectfactory.html">ObjectFactory</a> to create
interceptors</li><li><code>ValidatorFactory</code> - dedicated interface used
by <a shape="rect" href="objectfactory.html">ObjectFactory</a> to create
validators</li><li><code>ConverterFactory</code> - dedicated interface used by
<a shape="rect" href="objectfactory.html">ObjectFactory</a> to create instances
of <a shape="rect" class="createlink"
href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&title=TypeConverter&linkCreation=true&fromPageId=27470">TypeConverter</a></li></ul>
-
-
-<h2 id="ObjectFactory-Next:">Next: <a shape="rect"
href="actionmapper.html">ActionMapper</a></h2></div>
+</div></div><h3 id="ObjectFactory-Definededicatedfactory">Define dedicated
factory</h3><p>If you want to just extend one part of ObjectFactory, ie. to
change how <a shape="rect" href="result-types.html">Result Types</a> are build,
you can implement <code>ResultFactory</code> interface and register it with
dedicated name, see <a shape="rect"
href="plugins.html#Plugins-ExtensionPoints">Extension Points</a> for more
details. Original ObjectFactory will use these dedicated factories to do the
work. It's already done this way - the original functionality of ObjectFactory
was extracted to separated classes which implements the interfaces below. Check
the source of ObjectFactory to see more details. All these factories are
available as from version 2.3.16.</p><p>List of Factory interfaces:</p><ul
class="alternate"><li><code>ResultFactory</code> - dedicated interfaces used by
<a shape="rect" href="objectfactory.html">ObjectFactory</a> to create <a
shape="rect" href="result-types.html">Resul
t Types</a><ul class="alternate"><li><code>StrutsResultFactory</code> it's
internal implementation which checks if Result implements
<code>ParamNameAwareResult</code> interface to restrict names of parameters set
on the instance of Result, see <a shape="rect" href="result-types.html">Result
Types</a> for more info.</li></ul></li><li><code>ActionFactory</code> -
dedicated interface used by <a shape="rect"
href="objectfactory.html">ObjectFactory</a> to
actions</li><li><code>InterceptorFactory</code> - dedicated interface used by
<a shape="rect" href="objectfactory.html">ObjectFactory</a> to create
interceptors</li><li><code>ValidatorFactory</code> - dedicated interface used
by <a shape="rect" href="objectfactory.html">ObjectFactory</a> to create
validators</li><li><code>ConverterFactory</code> - dedicated interface used by
<a shape="rect" href="objectfactory.html">ObjectFactory</a> to create instances
of <a shape="rect" class="createlink"
href="https://cwiki.apache.org/confluence/page
s/createpage.action?spaceKey=WW&title=TypeConverter&linkCreation=true&fromPageId=27470">TypeConverter</a></li><li><code>UnknownHandlerFactory</code>
- dedicated interfaces used by <a shape="rect"
href="objectfactory.html">ObjectFactory</a> to create instances of <a
shape="rect" href="unknown-handlers.html">Unknown Handlers</a> (as from
version 2.3.18)</li></ul><h2 id="ObjectFactory-Next:">Next: <a shape="rect"
href="actionmapper.html">ActionMapper</a></h2></div>
</div>
Modified: websites/production/struts/content/release/2.3.x/docs/ognl.html
==============================================================================
--- websites/production/struts/content/release/2.3.x/docs/ognl.html (original)
+++ websites/production/struts/content/release/2.3.x/docs/ognl.html Fri Jul 25
15:44:36 2014
@@ -138,12 +138,7 @@ under the License.
<div class="pagecontent">
<div class="wiki-content">
- <div id="ConfluenceContent"><p>OGNL is the Object Graph Navigation
Language (see <a shape="rect" class="external-link"
href="http://commons.apache.org/proper/commons-ognl/">http://commons.apache.org/proper/commons-ognl/</a>
for the full documentation of OGNL). Here, we will cover a few examples of
OGNL features that co-exist with the framework. To review basic concepts, refer
to <a shape="rect" href="ognl-basics.html">OGNL Basics</a>.</p>
-
-<p>The framework uses a standard naming context to evaluate OGNL expressions.
The top level object dealing with OGNL is a Map (usually referred as a context
map or context). OGNL has a notion of there being a root (or default) object
within the context. In expression, the properties of the root object can be
referenced without any special "marker" notion. References to other objects are
marked with a pound sign (<code>#</code>).</p>
-
-<p>The framework sets the OGNL context to be our ActionContext, and the value
stack to be the OGNL root object. (The value stack is a set of several objects,
but to OGNL it appears to be a single object.) Along with the value stack, the
framework places other objects in the ActionContext, including Maps
representing the application, session, and request contexts. These objects
coexist in the ActionContext, alongside the value stack (our OGNL root).</p>
-<div class="preformatted panel" style="border-width: 1px;"><div
class="preformattedContent panelContent">
+ <div id="ConfluenceContent"><p>OGNL is the Object Graph Navigation
Language (see <a shape="rect" class="external-link"
href="http://commons.apache.org/proper/commons-ognl/">http://commons.apache.org/proper/commons-ognl/</a>
for the full documentation of OGNL). Here, we will cover a few examples of
OGNL features that co-exist with the framework. To review basic concepts, refer
to <a shape="rect" href="ognl-basics.html">OGNL Basics</a>.</p><p>The framework
uses a standard naming context to evaluate OGNL expressions. The top level
object dealing with OGNL is a Map (usually referred as a context map or
context). OGNL has a notion of there being a root (or default) object within
the context. In expression, the properties of the root object can be referenced
without any special "marker" notion. References to other objects are marked
with a pound sign (<code>#</code>).</p><p>The framework sets the OGNL context
to be our ActionContext, and the value stack to be the OGNL root obj
ect. (The value stack is a set of several objects, but to OGNL it appears to
be a single object.) Along with the value stack, the framework places other
objects in the ActionContext, including Maps representing the application,
session, and request contexts. These objects coexist in the ActionContext,
alongside the value stack (our OGNL root).</p><div class="preformatted panel"
style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre> |
|--application
|
@@ -160,57 +155,29 @@ under the License.
|--attr (searches page, request, session, then
application scopes)
|
</pre>
-</div></div>
-<p><img class="emoticon emoticon-information"
src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/information.png"
data-emoticon-name="information" alt="(info)"> There are other objects in the
context map. The diagram is for example only.</p>
-
-<p>The Action instance is always pushed onto the value stack. Because the
Action is on the stack, and the stack is the OGNL root, references to Action
properties can omit the <code>#</code> marker. But, to access other objects in
the ActionContext, we must use the <code>#</code> notation so OGNL knows not to
look in the root object, but for some other object in the ActionContext.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Referencing an Action
property</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<s:property value="postalCode"/>
+</div></div><p><img class="emoticon emoticon-information"
src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/information.png"
data-emoticon-name="information" alt="(info)"> There are other objects in the
context map. The diagram is for example only.</p><p>The Action instance is
always pushed onto the value stack. Because the Action is on the stack, and the
stack is the OGNL root, references to Action properties can omit the
<code>#</code> marker. But, to access other objects in the ActionContext, we
must use the <code>#</code> notation so OGNL knows not to look in the root
object, but for some other object in the ActionContext.</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>Referencing an Action
property</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<s:property
value="postalCode"/>
]]></script>
-</div></div>
-<p>Other (non-root) objects in the ActionContext can be rendered use the
<code>#</code> notation.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<s:property value="#session.mySessionPropKey"/> or
+</div></div><p>Other (non-root) objects in the ActionContext can be rendered
use the <code>#</code> notation.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<s:property
value="#session.mySessionPropKey"/> or
<s:property value="#session['mySessionPropKey']"/> or
<s:property value="#request['myRequestPropKey']"/>
]]></script>
-</div></div>
-<p>The ActionContext is also exposed to Action classes via a static method.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-ActionContext.getContext().getSession().put("mySessionPropKey",
mySessionObject);
+</div></div><p>The ActionContext is also exposed to Action classes via a
static method.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[ActionContext.getContext().getSession().put("mySessionPropKey",
mySessionObject);
]]></script>
-</div></div>
-<p>You can also put expression for attributes that don't support dynamic
content, like below:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<c:set var="foo" value="bar"
scope="request"/>
+</div></div><p>You can also put expression for attributes that don't support
dynamic content, like below:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[<c:set var="foo"
value="bar" scope="request"/>
<s:textfield name="username" label="%{#request.foo}"
/>
]]></script>
-</div></div>
-
-<h2 id="OGNL-Collections(Maps,Lists,Sets)">Collections (Maps, Lists, Sets)</h2>
-
-<p>Dealing with Collections (Maps, Lists, and Sets) in the framework comes
often, so below please there are a few examples using the select tag. The <a
shape="rect" class="external-link"
href="http://www.opensymphony.com/ognl/html/LanguageGuide/collectionConstruction.html"
rel="nofollow">OGNL documentation</a> also includes some examples.</p>
-
-<p>Syntax for list: {e1,e2,e3}. This idiom creates a List containing the
String "name1", "name2" and "name3". It also selects "name2" as the default
value.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<s:select label="label" name="name"
list="{'name1','name2','name3'}"
value="%{'name2'}" />
+</div></div><h2 id="OGNL-Collections(Maps,Lists,Sets)">Collections (Maps,
Lists, Sets)</h2><p>Dealing with Collections (Maps, Lists, and Sets) in the
framework comes often, so below please there are a few examples using the
select tag. The <a shape="rect" class="external-link"
href="http://commons.apache.org/proper/commons-ognl/language-guide.html#Collection_Construction">OGNL
documentation</a> also includes some examples.</p><p>Syntax for list:
{e1,e2,e3}. This idiom creates a List containing the String "name1", "name2"
and "name3". It also selects "name2" as the default value.</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<s:select label="label"
name="name"
list="{'name1','name2','name3'}"
value="%{'name2'}" />
]]></script>
-</div></div>
-<p>Syntax for map: #{key1:value1,key2:value2}. This idiom creates a map that
maps the string "foo" to the string "foovalue" and "bar" to the string
"barvalue":</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<s:select label="label" name="name"
list="#{'foo':'foovalue',
'bar':'barvalue'}" />
+</div></div><p>Syntax for map: #{key1:value1,key2:value2}. This idiom creates
a map that maps the string "foo" to the string "foovalue" and "bar" to the
string "barvalue":</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<s:select label="label"
name="name" list="#{'foo':'foovalue',
'bar':'barvalue'}" />
]]></script>
-</div></div>
-<p>To determine if an element exists in a Collection, use the operations
<code>in</code> and <code>not in</code>.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<s:if test="'foo' in {'foo','bar'}">
+</div></div><p>To determine if an element exists in a Collection, use the
operations <code>in</code> and <code>not in</code>.</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<s:if test="'foo' in
{'foo','bar'}">
muhahaha
</s:if>
<s:else>
@@ -224,46 +191,20 @@ ActionContext.getContext().getSession().
boo
</s:else>
]]></script>
-</div></div>
-<p>To select a subset of a collection (called projection), use a wildcard
within the collection.</p>
-<ul class="alternate"><li>? - All elements matching the selection
logic</li><li>^ - Only the first element matching the selection logic</li><li>$
- Only the last element matching the selection logic</li></ul>
-
-
-<p>To obtain a subset of just male relatives from the object person:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-person.relatives.{? #this.gender == 'male'}
+</div></div><p>To select a subset of a collection (called projection), use a
wildcard within the collection.</p><ul class="alternate"><li>? - All elements
matching the selection logic</li><li>^ - Only the first element matching the
selection logic</li><li>$ - Only the last element matching the selection
logic</li></ul><p>To obtain a subset of just male relatives from the object
person:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[person.relatives.{? #this.gender ==
'male'}
]]></script>
-</div></div>
-
-<h2 id="OGNL-LambdaExpressions">Lambda Expressions</h2>
-
-<p>OGNL supports basic lamba expression syntax enabling you to write simple
functions.</p>
-
-<p>(Dedicated to all you math majors who didn't think you would ever see this
one again.)</p>
-
-<p>Fibonacci: if n==0 return 0; elseif n==1 return 1; else return
fib(n-2)+fib(n-1);<br clear="none">
-fib(0) = 0<br clear="none">
-fib(1) = 1<br clear="none">
-fib(11) = 89</p>
-
- <div class="aui-message hint shadowed information-macro">
+</div></div><h2 id="OGNL-LambdaExpressions">Lambda Expressions</h2><p>OGNL
supports basic lamba expression syntax enabling you to write simple
functions.</p><p>(Dedicated to all you math majors who didn't think you would
ever see this one again.)</p><p>Fibonacci: if n==0 return 0; elseif n==1 return
1; else return fib(n-2)+fib(n-1);<br clear="none"> fib(0) = 0<br clear="none">
fib(1) = 1<br clear="none"> fib(11) = 89</p> <div class="aui-message hint
shadowed information-macro">
<p class="title">How the expression works</p>
<span class="aui-icon icon-hint">Icon</span>
<div class="message-content">
-
-<p>The lambda expression is everything inside the square brackets. The #this
variable holds the argument to the expression, which in the following example
is the number 11 (the code after the square-bracketed lamba expression,
<code>#fib(11)</code>).</p>
+ <p>The lambda expression is everything inside the
square brackets. The #this variable holds the argument to the expression, which
in the following example is the number 11 (the code after the square-bracketed
lamba expression, <code>#fib(11)</code>).</p>
</div>
</div>
-
-
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<s:property value="#fib =:[#this==0 ? 0 : #this==1 ? 1 :
#fib(#this-2)+#fib(#this-1)], #fib(11)" />
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<s:property value="#fib =:[#this==0 ?
0 : #this==1 ? 1 : #fib(#this-2)+#fib(#this-1)], #fib(11)" />
]]></script>
-</div></div>
-
-<h2 id="OGNL-Next:">Next: <a shape="rect" href="tag-syntax.html">Tag
Syntax</a></h2></div>
+</div></div><h2 id="OGNL-Next:">Next: <a shape="rect"
href="tag-syntax.html">Tag Syntax</a></h2></div>
</div>
<div class="tabletitle">