You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ma...@apache.org on 2009/12/27 19:01:09 UTC
svn commit: r894087 [43/46] - in /struts/xwork/trunk: ./ assembly/
assembly/src/ assembly/src/main/ assembly/src/main/assembly/
assembly/src/main/resources/ core/ core/src/ core/src/main/
core/src/main/java/ core/src/main/java/com/ core/src/main/java/c...
Added: struts/xwork/trunk/docs/wikidocs/ValidationParameter annotation.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/ValidationParameter%20annotation.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/ValidationParameter annotation.html (added)
+++ struts/xwork/trunk/docs/wikidocs/ValidationParameter annotation.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,62 @@
+<html>
+ <head>
+ <title>XWork -
+ ValidationParameter annotation
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+
+<h1><a name="ValidationParameterannotation-ValidationParameterAnnotation"></a>ValidationParameter Annotation</h1>
+
+<p>The ValidationParameter annotation is used as a parameter for CustomValidators.</p>
+
+<h2><a name="ValidationParameterannotation-Usage"></a>Usage</h2>
+
+<p><p/>The annotation must embedded into CustomValidator annotations as a parameter.</p>
+
+<h2><a name="ValidationParameterannotation-Parameters"></a>Parameters</h2>
+
+<p><table class='confluenceTable'>
+<tr>
+<th class='confluenceTh'> Parameter </th>
+<th class='confluenceTh'> Required </th>
+<th class='confluenceTh'> Default </th>
+<th class='confluenceTh'> Notes </th>
+</tr>
+<tr>
+<td class='confluenceTd'>name</td>
+<td class='confluenceTd'>yes</td>
+<td class='confluenceTd'> </td>
+<td class='confluenceTd'>parameter name.</td>
+</tr>
+<tr>
+<td class='confluenceTd'>value</td>
+<td class='confluenceTd'>yes</td>
+<td class='confluenceTd'> </td>
+<td class='confluenceTd'>parameter value.</td>
+</tr>
+</table></p>
+
+<h2><a name="ValidationParameterannotation-Examples"></a>Examples</h2>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java">@CustomValidator(
+ type =<span class="code-quote">"customValidatorName"</span>,
+ fieldName = <span class="code-quote">"myField"</span>,
+ parameters = { @ValidationParameter( name = <span class="code-quote">"paramName"</span>, value = <span class="code-quote">"paramValue"</span> ) }
+)</pre>
+</div></div>
+
+
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/ValidationParameter annotation.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/ValidationParameter annotation.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/Validations Annotation.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/Validations%20Annotation.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/Validations Annotation.html (added)
+++ struts/xwork/trunk/docs/wikidocs/Validations Annotation.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,134 @@
+<html>
+ <head>
+ <title>XWork -
+ Validations Annotation
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <p><p>If you want to use several annotations of the same type, these annotations must be nested within the @Validations() annotation.</p></p>
+
+<h2><a name="ValidationsAnnotation-Usage"></a>Usage</h2>
+
+<p><p/>Used at METHOD level.</p>
+
+<h2><a name="ValidationsAnnotation-Parameters"></a>Parameters</h2>
+
+<p><table class='confluenceTable'></p>
+
+<p><tr>
+<th class='confluenceTh'> Parameter </th>
+<th class='confluenceTh'> Required </th>
+<th class='confluenceTh'> Notes </th>
+</tr>
+<tr>
+<td class='confluenceTd'> requiredFields </td>
+<td class='confluenceTd'> no </td></p>
+
+<p><td class='confluenceTd'> Add list of RequiredFieldValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> customValidators </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of CustomValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> conversionErrorFields </td></p>
+
+<p><td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of ConversionErrorFieldValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> dateRangeFields </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of DateRangeFieldValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> emails </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of EmailValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> fieldExpressions </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of FieldExpressionValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> intRangeFields </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of IntRangeFieldValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> requiredStrings </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of RequiredStringValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> stringLengthFields </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of StringLengthFieldValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> urls </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of UrlValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> visitorFields </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of VisitorFieldValidators </td>
+</tr>
+<tr>
+<td class='confluenceTd'> regexFields </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of RegexFieldValidator </td>
+</tr>
+<tr>
+<td class='confluenceTd'> expressions </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> Add list of ExpressionValidator </td>
+</tr>
+</table></p>
+
+<h2><a name="ValidationsAnnotation-Examples"></a>Examples</h2>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java">@Validations(
+ requiredFields =
+ {@RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName = <span class="code-quote">"customfield"</span>, message = <span class="code-quote">"You must enter a value <span class="code-keyword">for</span> field."</span>)},
+ requiredStrings =
+ {@RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = <span class="code-quote">"stringisrequired"</span>, message = <span class="code-quote">"You must enter a value <span class="code-keyword">for</span> string."</span>)},
+ emails =
+ { @EmailValidator(type = ValidatorType.SIMPLE, fieldName = <span class="code-quote">"emailaddress"</span>, message = <span class="code-quote">"You must enter a value <span class="code-keyword">for</span> email."</span>)},
+ urls =
+ { @UrlValidator(type = ValidatorType.SIMPLE, fieldName = <span class="code-quote">"hreflocation"</span>, message = <span class="code-quote">"You must enter a value <span class="code-keyword">for</span> email."</span>)},
+ stringLengthFields =
+ {@StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = <span class="code-keyword">true</span>, minLength=<span class="code-quote">"10"</span> , maxLength = <span class="code-quote">"12"</span>, fieldName = <span class="code-quote">"needstringlength"</span>, message = <span class="code-quote">"You must enter a stringlength."</span>)},
+ intRangeFields =
+ { @IntRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = <span class="code-quote">"intfield"</span>, min = <span class="code-quote">"6"</span>, max = <span class="code-quote">"10"</span>, message = <span class="code-quote">"bar must be between ${min} and ${max}, current value is ${bar}."</span>)},
+ dateRangeFields =
+ {@DateRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = <span class="code-quote">"datefield"</span>, min = <span class="code-quote">"-1"</span>, max = <span class="code-quote">"99"</span>, message = <span class="code-quote">"bar must be between ${min} and ${max}, current value is ${bar}."</span>)},
+ expressions = {
+ @ExpressionValidator(expression = <span class="code-quote">"foo > 1"</span>, message = <span class="code-quote">"Foo must be greater than Bar 1. Foo = ${foo}, Bar = ${bar}."</span>),
+ @ExpressionValidator(expression = <span class="code-quote">"foo > 2"</span>, message = <span class="code-quote">"Foo must be greater than Bar 2. Foo = ${foo}, Bar = ${bar}."</span>),
+ @ExpressionValidator(expression = <span class="code-quote">"foo > 3"</span>, message = <span class="code-quote">"Foo must be greater than Bar 3. Foo = ${foo}, Bar = ${bar}."</span>),
+ @ExpressionValidator(expression = <span class="code-quote">"foo > 4"</span>, message = <span class="code-quote">"Foo must be greater than Bar 4. Foo = ${foo}, Bar = ${bar}."</span>),
+ @ExpressionValidator(expression = <span class="code-quote">"foo > 5"</span>, message = <span class="code-quote">"Foo must be greater than Bar 5. Foo = ${foo}, Bar = ${bar}."</span>)
+ }
+ )
+ <span class="code-keyword">public</span> <span class="code-object">String</span> execute() <span class="code-keyword">throws</span> Exception {
+ <span class="code-keyword">return</span> SUCCESS;
+ }</pre>
+</div></div>
+
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/Validations Annotation.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/Validations Annotation.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/VisitorFieldValidator Annotation.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/VisitorFieldValidator%20Annotation.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/VisitorFieldValidator Annotation.html (added)
+++ struts/xwork/trunk/docs/wikidocs/VisitorFieldValidator Annotation.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,85 @@
+<html>
+ <head>
+ <title>XWork -
+ VisitorFieldValidator Annotation
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <p>The validator allows you to forward validator to object properties of your action
+using the objects own validator files. This allows you to use the ModelDriven development
+pattern and manage your validations for your models in one place, where they belong, next to
+your model classes.</p>
+
+<p>The VisitorFieldValidator can handle either simple Object properties, Collections of Objects, or Arrays.
+The error message for the VisitorFieldValidator will be appended in front of validator messages added
+by the validations for the Object message.</p>
+
+<h2><a name="VisitorFieldValidatorAnnotation-Usage"></a>Usage</h2>
+
+<p><p/>The annotation must be applied at method level.</p>
+
+<h2><a name="VisitorFieldValidatorAnnotation-Parameters"></a>Parameters</h2>
+
+<p><table class='confluenceTable'>
+<tr>
+<th class='confluenceTh'> Parameter </th>
+<th class='confluenceTh'> Required </th>
+<th class='confluenceTh'> Default </th>
+<th class='confluenceTh'> Notes </th>
+</tr>
+<tr>
+<td class='confluenceTd'>message</td>
+<td class='confluenceTd'>yes</td>
+<td class='confluenceTd'> </td>
+<td class='confluenceTd'>field error message</td>
+</tr>
+<tr>
+<td class='confluenceTd'>key</td>
+<td class='confluenceTd'>no</td>
+<td class='confluenceTd'> </td>
+<td class='confluenceTd'>i18n key from language specific properties file.</td>
+</tr>
+<tr>
+<td class='confluenceTd'>fieldName</td>
+<td class='confluenceTd'>no</td>
+<td class='confluenceTd'> </td>
+<td class='confluenceTd'> </td>
+</tr>
+<tr>
+<td class='confluenceTd'>shortCircuit</td>
+<td class='confluenceTd'>no</td>
+<td class='confluenceTd'>false</td>
+<td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+</tr>
+<tr>
+<td class='confluenceTd'> context </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> action alias </td>
+<td class='confluenceTd'> Determines the context to use for validating the Object property. If not defined, the context of the Action validation is propogated to the Object property validation. In the case of Action validation, this context is the Action alias. </td>
+</tr>
+<tr>
+<td class='confluenceTd'> appendPrefix </td>
+<td class='confluenceTd'> no </td>
+<td class='confluenceTd'> true </td>
+<td class='confluenceTd'> Determines whether the field name of this field validator should be prepended to the field name of the visited field to determine the full field name when an error occurs. For example, suppose that the bean being validated has a "name" property. If <em>appendPrefix</em> is true, then the field error will be stored under the field "bean.name". If <em>appendPrefix</em> is false, then the field error will be stored under the field "name". <br clear="all" /> <img class="emoticon" src="/images/icons/emoticons/warning.gif" height="16" width="16" align="absmiddle" alt="" border="0"/> If you are using the VisitorFieldValidator to validate the model from a ModelDriven Action, you should set <em>appendPrefix</em> to false unless you are using "model.name" to reference the properties on your model. </td>
+</tr>
+</table></p>
+
+<h2><a name="VisitorFieldValidatorAnnotation-Examples"></a>Examples</h2>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java">@VisitorFieldValidator(message = <span class="code-quote">"Default message"</span>, key = <span class="code-quote">"i18n.key"</span>, shortCircuit = <span class="code-keyword">true</span>, context = <span class="code-quote">"action alias"</span>, appendPrefix = <span class="code-keyword">true</span>)</pre>
+</div></div>
+
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/VisitorFieldValidator Annotation.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/VisitorFieldValidator Annotation.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Actions.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Actions.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Actions.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Actions.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,68 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Actions
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <p>XWork2 Action serves as to capture a particular execution logic. It is distinguished by its unique name and namespace combination. </p>
+
+<table cellpadding='5' width='85%' cellspacing='8px' class='warningMacro' border="0" align='center'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="./icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>
+<p>XWork2 parses its xml configuration according to order. If an action extends off another parent action, the parent action MUST be defined before the action that planned to extend it</p></td></tr></table>
+
+<h2><a name="XWorkActions-Nameandnamespace"></a>Name and namespace</h2>
+<p>An action is identified by its name and namespace combination. By default, if an action with a specified name and namespace does not exists, it will fall back to an action with the same name but a default namespace (empty namespace) if such a combination exists.</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><xwork>
+ <<span class="code-keyword">package</span> name=<span class="code-quote">"<span class="code-keyword">default</span>"</span> namespace=<span class="code-quote">"/myNamespace"</span>>
+ ...
+ <action name=<span class="code-quote">"myAction"</span> ...>
+ ....
+ </action>
+ ...
+ </<span class="code-keyword">package</span>>
+</xwork></pre>
+</div></div>
+
+<h2><a name="XWorkActions-Actionclass"></a>Action class</h2>
+<p>An action class could be :-</p>
+<ul>
+ <li>plain pojo (extends java.lang.Object which by default every java class does)</li>
+ <li>implements com.opensymphony.xwork2.Action interface</li>
+ <li>extends com.opensymphony.xwork2.ActionSupport</li>
+</ul>
+
+
+<h3><a name="XWorkActions-ActionContext"></a>Action Context</h3>
+<p>Action could access its context using ActionContext. Parmameter passing could be done using this action context. Following is an example</p>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java">ActionProxyFactory factory = ActionProxyFactory.getFactory();
+ factory.createActionProxy(configuration, <span class="code-quote">"actionAlias"</span>, <span class="code-quote">"/namespace"</span>,
+ <span class="code-keyword">new</span> LinkedHashMap() {
+ {
+ <span class="code-comment">// pass in parameter
+</span> put(<span class="code-quote">"someParameter"</span>, <span class="code-quote">"some parameter value"</span>);
+ }
+ }
+ );
+
+ <span class="code-comment">// latter on, we could <span class="code-keyword">do</span> <span class="code-keyword">this</span>
+</span>
+ ActionContext context = ActionContext.getContext();
+ Map contextMap = context.getContextMap();
+ contextMap.get(<span class="code-quote">"someParameter"</span>);</pre>
+</div></div>
+
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Actions.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Actions.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Architecture.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Architecture.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Architecture.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Architecture.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,34 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Architecture
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <p>XWork2 is designed around the concept of GOF's Command Design Pattern.</p>
+
+<h2><a name="XWorkArchitecture-CommandDesignPattern"></a>Command Design Pattern</h2>
+
+
+<h3><a name="XWorkArchitecture-General"></a>General</h3>
+
+<p>A Command design pattern, abstract the logic of a particular execution into an object, the command object. If an originator is to interact with a receiver using a command pattern, direct reference between them could be abstracted away. Originator would probably create a command object, that when executed will know how to get its receiver and perform the necessary logics. There could be a variety of command that being able to communicate with a variety of receivers, most probably created through some sort of Factory pattern.</p>
+
+<h3><a name="XWorkArchitecture-RelationwithXWork2"></a>Relation with XWork2</h3>
+
+<p>Command in XWork2 sense would be XWork2 Action, while the originator would most possibly translate to the client that grab hold of a copy of XWork2 Action. A receiver will most likely be XWork2 Result. XWork2 enhance the concept a bit with the introduction of ActionProxy, a thin layer representing the action such that action could be loaded differently and ActionInvocation which details the actual execution of the action itself.</p>
+
+<h2><a name="XWorkArchitecture-Architecture"></a>Architecture</h2>
+<p><img src="XWork Architecture_attachments/xwork-flow.jpg" align="absmiddle" border="0" /></p>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Architecture.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Architecture.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Architecture_attachments/xwork-flow.jpg
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Architecture_attachments/xwork-flow.jpg?rev=894087&view=auto
==============================================================================
Binary file - no diff available.
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Architecture_attachments/xwork-flow.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/xwork/trunk/docs/wikidocs/XWork Architecture_attachments/xwork_architecture.jpeg
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Architecture_attachments/xwork_architecture.jpeg?rev=894087&view=auto
==============================================================================
Binary file - no diff available.
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Architecture_attachments/xwork_architecture.jpeg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/xwork/trunk/docs/wikidocs/XWork Articles.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Articles.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Articles.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Articles.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,24 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Articles
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <table cellpadding='5' width='85%' cellspacing='8px' class='noteMacro' border="0" align='center'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="./icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>
+<p> Anybody who have an article about XWork2, please feel free to drop me a line and I'll have it up in here. Cheers.</p></td></tr></table>
+
+
+<p>// TODO: Articles related to XWork2</p>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Articles.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Articles.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Configurations.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Configurations.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Configurations.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Configurations.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,94 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Configurations
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <p>Configuring XWork2 centers around the following classes:-</p>
+<ul>
+ <li>ConfigurationManager</li>
+ <li>ConfigurationProvider</li>
+ <li>Configuration</li>
+</ul>
+
+
+<p>where by both ConfigurationProvider and Configuration are java interface.</p>
+
+<h2><a name="XWorkConfigurations-ConfigurationManager"></a>ConfigurationManager</h2>
+
+<p>This is the center for configuring XWork2. It allows ConfigurationProvider to be pluged in and setting a custom Configuration to be used. Typically one would like to just create one instance of ConfigurationManager for a XWork2 usage.</p>
+
+<h3><a name="XWorkConfigurations-Code"></a>Code</h3>
+
+<p>To create a ConfigurationManager :-</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java">ConfigurationManager confManager = <span class="code-keyword">new</span> ConfigurationManager();</pre>
+</div></div>
+
+<h2><a name="XWorkConfigurations-ConfigurationProvider"></a>ConfigurationProvider</h2>
+
+<p>ConfigurationProvider helps configuring a Configuration, populating it with information regarding what actions it has, how does the results get mapped and what interceptors are there and how they are related to each action etc. A default ConfigurationProvider that comes with XWork2 would be XmlConfigurationProvider and as the name suggest populate information into a Configuration object according the the xml provided.</p>
+
+<h3><a name="XWorkConfigurations-Code"></a>Code</h3>
+
+<p>To create a plug in a custom configuration provider</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java">ConfigurationManager confManager = <span class="code-keyword">new</span> ConfigurationManager();
+ confManager.addConfigurationProvider(
+ <span class="code-keyword">new</span> MyCustomConfigurationProvider(....));</pre>
+</div></div>
+<p>To create an XmlConfigurationProvider that points to a particular xml file in the classpath:-</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java">ConfigurationManager confManager = <span class="code-keyword">new</span> ConfigurationManager();
+ confManager.addConfigurationProvider(
+ <span class="code-keyword">new</span> XmlConfigurationProvider(<span class="code-quote">"foo/bar/myConf.xml"</span>));</pre>
+</div></div>
+
+<h2><a name="XWorkConfigurations-Configuration"></a>Configuration</h2>
+
+<p>Configuration is a typical value object that contains configuration information. There's only one instance of it for each ConfigurationManager, where it is passed to different ConfigurationProvider in order for information to get stoted in it. The default implementation would be DefaultConfiguration.</p>
+
+<h3><a name="XWorkConfigurations-Code"></a>Code</h3>
+
+<p>To plug in a custom Configuration</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java">ConfigurationManager confManager = <span class="code-keyword">new</span> ConfigurationManager();
+ confManager.setConfiguration(<span class="code-keyword">new</span> MyCustomConfiguration(...));</pre>
+</div></div>
+<p>The following illustrates typically how XWork2 is configured in the <tt>xwork.xml</tt> configuration file:</p>
+
+<div class="code"><div class="codeContent">
+<pre class="code-xml"><span class="code-tag"><?xml version=<span class="code-quote">"1.0"</span> encoding=<span class="code-quote">"UTF-8"</span>?></span>
+<!DOCTYPE xwork PUBLIC
+ <span class="code-quote">"-//OpenSymphony Group//XWork 1.1.1//EN"</span>
+ <span class="code-quote">"http://www.opensymphony.com/xwork/xwork-1.1.1.dtd"</span>>
+
+
+<span class="code-tag"><xwork></span>
+ <span class="code-tag"><include file=<span class="code-quote">"xwork-default.xml"</span> /></span>
+ <span class="code-tag"><package name=<span class="code-quote">"default-hello-world"</span> extends=<span class="code-quote">"xwork-default"</span> namespace=<span class="code-quote">"/helloWorld"</span>></span>
+ <span class="code-tag"><result-types></span>
+ <span class="code-tag"><result-type name=<span class="code-quote">"printToConsole"</span> class=<span class="code-quote">"com.opensymphony.xwork2.showcase.PrintToConsoleResult"</span> /></span>
+ <span class="code-tag"></result-types></span>
+
+ <span class="code-tag"><action name=<span class="code-quote">"helloWorld"</span> class=<span class="code-quote">"com.opensymphony.xwork2.showcase.helloworld.HelloWorldAction"</span>></span>
+ <span class="code-tag"><result type=<span class="code-quote">"printToConsole"</span>></span>
+ <span class="code-tag"><param name=<span class="code-quote">"param"</span>></span>${message}<span class="code-tag"></param></span>
+ <span class="code-tag"></result></span>
+ <span class="code-tag"></action></span>
+ <span class="code-tag"></package></span>
+<span class="code-tag"></xwork></span></pre>
+</div></div>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Configurations.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Configurations.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Conversion.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Conversion.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Conversion.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Conversion.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,86 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Conversion
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <ul class="alternate" type="square">
+ <li>how conversion works (plugin in through Ognl)</li>
+ <li>how to have custom converters</li>
+ <li>examples</li>
+</ul>
+
+
+<p>XWork2 supports validation at a global and action level</p>
+
+<h2><a name="XWorkConversion-Howitworks"></a>How it works</h2>
+
+<p>XWork2 make use of Ognl to do its conversion, by plugging in XWork2 specifi PropertyAccessor, MethodAccessor, NullHandler and TypeConverter etc. into Ognl runtime.</p>
+
+<h2><a name="XWorkConversion-GlobalLevel"></a>Global Level</h2>
+
+<p>To create a global level conversion, create an file called 'xwork-conversion.properties' at the root level of classpath. The entry in 'xwork-conversion.properties' should be a key-value pair just like any Java property file, where the key represents the FQN (Fully-Qualified-Name) of a particular object where conversion is to be done, whereas the value would be the FQN of the XWork2 converter itself.</p>
+
+<p>The following is an example of a hypotenical 'xwork-conversion.properties'</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java">....
+ java.lang.<span class="code-object">Boolean</span>=foo.bar.MyBooleanConverter
+ foo.bar.MyObject=foo.bar.MyObjectConverter
+ ...</pre>
+</div></div>
+<p> </p>
+
+<h2><a name="XWorkConversion-ActionLevel"></a>Action Level</h2>
+
+<p>To create an action-level conversion, create a file called 'ActionClassName-conversion.properties' in the same location at the classpath where the Action class itself resides. Eg. if the action class name is MyAction, the action-level convertion properties file should be named 'MyAction-conversion.properties'.</p>
+
+<p>Assuming that 'MyAction' action class looks as follows. Note the properties it has.</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">public</span> class MyAction <span class="code-keyword">extends</span> ActionSupport {
+ <span class="code-keyword">private</span> <span class="code-object">Boolean</span> myBool;
+ <span class="code-keyword">private</span> <span class="code-object">Double</span> myDouble;
+
+ <span class="code-keyword">public</span> <span class="code-object">Boolean</span> getMyBool() { <span class="code-keyword">return</span> <span class="code-keyword">this</span>.myBool; }
+ <span class="code-keyword">public</span> void setMyBool(<span class="code-object">Boolean</span> myBool) { <span class="code-keyword">this</span>.myBool = myBool; }
+
+ <span class="code-keyword">public</span> <span class="code-object">Double</span> getMyDouble() { <span class="code-keyword">return</span> <span class="code-keyword">this</span>.myDouble; }
+ <span class="code-keyword">public</span> void setMyDouble(<span class="code-object">Double</span> myDouble) { <span class="code-keyword">this</span>.myDouble = myDouble; }
+
+ .....
+ }</pre>
+</div></div>
+<p> </p>
+
+<p>The following would an example of a hypotenical 'MyAction-conversion.properties'.</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java">myBool=foo.bar.MyBooleanConverter
+myDouble=foo.bar.MyDoubleConverter</pre>
+</div></div>
+<p> </p>
+
+<h2><a name="XWorkConversion-CustomConverter"></a>Custom Converter</h2>
+
+<p>The following is an example of a converter. It extends DefaultTypeConverter (part of Ognl).</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">public</span> class MyConverter <span class="code-keyword">extends</span> DefaultTypeConverter {
+ <span class="code-keyword">public</span> <span class="code-object">Object</span> convertValue(Map context, <span class="code-object">Object</span> target, Member member, <span class="code-object">String</span> propertyName,
+ <span class="code-object">Object</span> value, <span class="code-object">Class</span> toType) {
+ <span class="code-comment">// type conversion goes here.
+</span> ....
+ }
+ }</pre>
+</div></div>
+<p> </p>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Conversion.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Conversion.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Core Concepts.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Core%20Concepts.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Core Concepts.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Core Concepts.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,69 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Core Concepts
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <h2><a name="XWorkCoreConcepts-XWorkCoreConcepts"></a>XWork Core Concepts</h2>
+
+<p>XWork is based on a number of core concepts that helps to explain how the framework works. The core concepts can be broken down into two parts: Architecture Concepts and Terminology.</p>
+
+<h2><a name="XWorkCoreConcepts-ArchitectureConcepts"></a>Architecture Concepts</h2>
+<ul>
+ <li>Explain Command Driven Architecture (in general)</li>
+ <li>Explain the implementation in XWork</li>
+</ul>
+
+
+<h2><a name="XWorkCoreConcepts-Terminology"></a>Terminology</h2>
+
+<h3><a name="XWorkCoreConcepts-Actions"></a>Actions</h3>
+
+<p>Actions are classes that get invoked in response to a request, execute some code and return a Result. Actions implement at a minimum a single method, execute(), that defines the entry point called by the framework. This method allows developers to define a unit of work that will be executed each time the Action is called.</p>
+
+<h3><a name="XWorkCoreConcepts-ActionContext"></a>ActionContext</h3>
+
+<p>The ActionContext provides access to the execution environment in the form of named objects during an Action invocation. A new ActionContext is created for each invocation allowing developers to access/modify these properties in a thread safe manner. The ActionContext makes a number of properties available that are typically set to appropriate values by the framework. In WebWork 2 for example, the ActionContext session map wraps an underlying HttpSession object. This allows access to environment specific properties without tying the core framework to a specific execution environment. For more information, see ActionContext in Basics.</p>
+
+<h3><a name="XWorkCoreConcepts-Interceptors"></a>Interceptors</h3>
+
+<p>In XWork, Interceptors are objects that dynamically intercept Action invocations. They provide the developer with the opportunity to define code that can be executed before and/or after the execution of an action. They also have the ability to prevent an action from executing. Interceptors provide developers a way to encapulate common functionality in a re-usable form that can be applied to one or more Actions. See Interceptors for further details.</p>
+
+<h3><a name="XWorkCoreConcepts-Stacks"></a>Stacks</h3>
+
+<p>To handle the case where developers want to apply more than a single Interceptor to an Action, Stacks have been introduced. Stacks are an ordered list of Interceptors and/or other Stacks that get applied when an Action is invoked. Stacks centralize the declaration of Interceptors and provide a convenient way to configure mutiple actions.</p>
+
+<h3><a name="XWorkCoreConcepts-Results"></a>Results</h3>
+
+<p>Results are string constants that Actions return to indicate the status of an Action execution. A standard set of Results are defined by default: error, input, login, none and success. Developers are, of course, free to create their own Results to indicate more application specific cases.</p>
+
+<h3><a name="XWorkCoreConcepts-ResultTypes"></a>Result Types</h3>
+
+<p>Result Types are classes that determine what happens after an Action executes and a Result is returned. Developers are free to create their own Result Types according to the needs of their application or environment. In WebWork 2 for example, Servlet and Velocity Result Types have been created to handle rendering views in web applications.</p>
+
+<h3><a name="XWorkCoreConcepts-Packages"></a>Packages</h3>
+
+<p>Packages are a way to group Actions, Results, Result Types, Interceptors and Stacks into a logical unit that shares a common configuration. Packages are similiar to objects in that they can be extended and have individual parts overridden by "sub" packages.</p>
+
+<h3><a name="XWorkCoreConcepts-ValueStack"></a>ValueStack</h3>
+
+<p>The ValueStack is a stack implementation built on top of an OGNL core. The OGNL expression language can be used to traverse the stack and retrieve the desired object. The OGNL expression language provides a number of additional features including: automatic type conversion, method invocation and object comparisons. For more information, see the <a href="http://ognl.org/" title="Visit page outside Confluence">OGNL Website</a>.</p>
+
+<h3><a name="XWorkCoreConcepts-Components"></a>Components</h3>
+
+<p>XWork provides the ComponentManager interface (and a corresponding implementation in the DefaultComponentManager class) to apply a design pattern known as <b>Inversion of Control</b> (or IoC for short). In a nutshell, the IoC pattern allows a parent object (in this case XWork's ComponentManager instance) to control a client object (usually an action, but it could be any object that implements the appropriate <em>enabler</em>). See Components for further details.</p>
+
+<h2><a name="XWorkCoreConcepts-Next%3AXWorkArticles"></a>Next: <a href="XWork Articles.html" title="XWork Articles">XWork Articles</a></h2>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Core Concepts.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Core Concepts.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork FAQs.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20FAQs.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork FAQs.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork FAQs.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,37 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork FAQs
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <table cellpadding='5' width='85%' cellspacing='8px' class='noteMacro' border="0" align='center'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="./icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>
+<p>Please feel free to add any FAQs that's appropriate</p></td></tr></table>
+
+<h2><a name="XWorkFAQs-General"></a>General</h2>
+
+<h2><a name="XWorkFAQs-Interceptor"></a>Interceptor</h2>
+
+<h2><a name="XWorkFAQs-Action"></a>Action</h2>
+
+<h2><a name="XWorkFAQs-Result"></a>Result</h2>
+
+<h2><a name="XWorkFAQs-PreResultListener"></a>PreResultListener</h2>
+
+<h2><a name="XWorkFAQs-Conversion"></a>Conversion</h2>
+
+<h2><a name="XWorkFAQs-Validation"></a>Validation</h2>
+
+<h2><a name="XWorkFAQs-Configuration"></a>Configuration</h2>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork FAQs.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork FAQs.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Features.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Features.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Features.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Features.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,173 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Features
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <h2><a name="XWorkFeatures-AboutXWork"></a>About XWork</h2>
+
+<p>XWork 2 is a generic command pattern framework. It forms the core of <a href="http://struts.apache.org" title="Visit page outside Confluence">Struts 2</a>. It features:</p>
+
+<ul>
+ <li>Flexible and customizable configuration based on a simple Configuration interface, allowing you to use XML , programmatic, or even product-integrated configuration</li>
+ <li>Core command pattern framework which can be customized and extended through the use of interceptors to fit any request / response environment</li>
+ <li>Built in type conversion and action property validation using <a href="http://www.ognl.org" title="Visit page outside Confluence">OGNL</a></li>
+ <li>Powerful validation framework based on runtime attributes and a validation interceptor</li>
+</ul>
+
+
+<h2><a name="XWorkFeatures-Overview"></a>Overview</h2>
+
+<p>Xwork is a command pattern framework centralized around an Action interface. You define action classes by implementing an Action interface, then XWork will setup and execute your actions. XWork is most widely known from the web MVC framework called Webwork. However, XWork can be used by itself, so its important to understand the XWork layers and how actions are set up and executed. This section describes the core layers within Xwork and provides a simple example of how to execute actions. </p>
+<ul>
+ <li>Action Interface</li>
+ <li>ActionProxy interface</li>
+ <li>ActionInvocation interface</li>
+ <li>ActionContext</li>
+ <li>A simple example</li>
+</ul>
+
+
+<p><br clear="all" />
+<img src="XWork Features_attachments/drawing1.gif" align="absmiddle" border="0" />
+<br clear="all" /></p>
+
+<h2><a name="XWorkFeatures-Actions"></a>Actions</h2>
+
+<p>Actions are the basic unit of execution...</p>
+
+<h4><a name="XWorkFeatures-TheActionInterface"></a>The Action Interface</h4>
+
+<p>The basic interface which all XWork actions must implement. It provides several standard return values like SUCCESS and INPUT, and only contains one method:</p>
+
+<div class="code" style="border-style: solid; "><div class="codeHeader" style="border-bottom-style: solid; "><b>Action.java</b></div><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">public</span> <span class="code-keyword">interface</span> Action {
+ <span class="code-keyword">public</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> <span class="code-object">String</span> SUCCESS = <span class="code-quote">"success"</span>;
+ <span class="code-keyword">public</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> <span class="code-object">String</span> NONE = <span class="code-quote">"none"</span>;
+ <span class="code-keyword">public</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> <span class="code-object">String</span> ERROR = <span class="code-quote">"error"</span>;
+ <span class="code-keyword">public</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> <span class="code-object">String</span> INPUT = <span class="code-quote">"input"</span>;
+ <span class="code-keyword">public</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> <span class="code-object">String</span> LOGIN = <span class="code-quote">"login"</span>;
+
+ <span class="code-keyword">public</span> <span class="code-object">String</span> execute() <span class="code-keyword">throws</span> Exception;</pre>
+</div></div>
+
+<p>In general, Actions can simply extend the com.opensymphony.xwork.ActionSupport class, which implements the Action interface and provides default behavior for the most common actions.</p>
+
+
+<h2><a name="XWorkFeatures-ActionProxy"></a>ActionProxy</h2>
+
+<p>Action lifecycles are maintained thru the ActionProxy interface. ActionProxy is the top layer in the Xwork API and should be the starting point to setup and execute actions. XWork provides a factory as an entry point to instantiate action proxies. Most of the implementations of each xwork layer are hidden behind interfaces making it very easy to override the default implementations for complete customization. </p>
+
+
+<p>Example how to obtain the default impl of ActionProxy (DefaultActionProxy.java)</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java">ActionProxyFactory.getFactory().createActionProxy(<span class="code-quote">"", "</span>viewBook", objectMap);</pre>
+</div></div>
+<p>If I need to register my own implementation of ActionProxy, then I may do so within the factory</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java">class CustomizedActionProxyFactory <span class="code-keyword">extends</span> DefaultActionProxyFactory{
+ createActionProxy(...){ <span class="code-keyword">return</span> <span class="code-keyword">new</span> CustomizedActionProxy(...); }
+}</pre>
+</div></div>
+<div class="code"><div class="codeContent">
+<pre class="code-java">ActionProxyFactory.setFactory(<span class="code-keyword">new</span> CustomizedActionProxyFactory());
+ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(...);</pre>
+</div></div>
+
+<h2><a name="XWorkFeatures-ActionInvocation"></a>ActionInvocation</h2>
+
+<p>Underneath the ActionProxy layer, exists the ActionInvocation interface. ActionInvocation represents the execution state of an action holding the action instance along with any interceptors that wrap before/after processing of the action. </p>
+
+<h2><a name="XWorkFeatures-ActionContext"></a>ActionContext</h2>
+
+<p>ActionContext provides access to the execution environment in the form of named objects during an Action invocation. A new ActionContext is created for each invocation allowing developers to access/modify these properties in a thread safe manner. The ActionContext makes a number of properties available that are typically set to appropriate values by the framework. In WebWork 2 for example, the ActionContext session map wraps an underlying HttpSession object. This allows access to environment specific properties without tying the core framework to a specific execution environment.</p>
+
+<p>The ActionContext is acquired through the static ActionContext.getContext() method. The ActionContext is a thread local variable and thus the properties of the ActionContext will be relative to the current request thread. The ActionContext has several methods for commonly used properties as well as get() and set() methods which can be used for application specific properties. </p>
+
+
+<h2><a name="XWorkFeatures-Asimpleexample"></a>A simple example</h2>
+
+<p>Lets look at a simple example starting with a simple javabean.</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">public</span> class Book {
+ <span class="code-object">String</span> id;
+ <span class="code-object">String</span> title;
+ Set authors;
+ <span class="code-keyword">public</span> void setId(id){ <span class="code-keyword">this</span>.id = id; }
+ <span class="code-keyword">public</span> void setTitle(<span class="code-object">String</span> title){ <span class="code-keyword">this</span>.title = title; }
+ <span class="code-keyword">public</span> void setAuthors(Set authors){ <span class="code-keyword">this</span>.authors = authors; }
+ <span class="code-keyword">public</span> <span class="code-object">String</span> getId(){ }
+ <span class="code-keyword">public</span> <span class="code-object">String</span> getTitle{ }
+ <span class="code-keyword">public</span> Set getAuthors{ }
+}</pre>
+</div></div>
+
+<p>Lets say that we need to retrieve a book object from a data source and pass it back to the caller. We can write an action to handle this. An action in xwork is typically a very simple class. The only requirement is that it implements the Action interface. These days you'll see actions as simple as javabeans with an execute method (Validation, Type conversion, and so forth can all be seperated out to provide a good separation of concerns). The purpose of action execution is typically to provide access and manipulation to your data. The result of the action execution is a simple string representation that should define delegation of the action after invocation. So a result could be a success string, a failure string, a forward string, or what ever. In our current example, a book object can be populated in the action if found with a result of "success" or if the book is not found then a "notFound" can be returned. From this, you can easily have a controlling object s
etup to return the book or possible forward the request off to a different inventory source if the book isn't found.</p>
+<div class="code" style="border-style: solid; "><div class="codeHeader" style="border-bottom-style: solid; "><b>com.opensymphony.xwork.example.ViewBookAction</b></div><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">public</span> class ViewBookAction <span class="code-keyword">implements</span> Action{
+ Book book;
+ <span class="code-object">String</span> id;
+
+ <span class="code-keyword">public</span> <span class="code-object">String</span> execute() <span class="code-keyword">throws</span> Exception{
+
+ <span class="code-comment">// lets pretend we have a data access object that will <span class="code-keyword">return</span> a book from storage
+</span> book = bookDAO.findById(id, Book.class);
+ <span class="code-keyword">if</span>(book != <span class="code-keyword">null</span>) <span class="code-keyword">return</span> <span class="code-quote">"success"</span>;
+ <span class="code-keyword">return</span> <span class="code-quote">"notFound"</span>;
+ }
+ <span class="code-keyword">public</span> Book getBook(){ <span class="code-keyword">return</span> <span class="code-keyword">this</span>.book; }
+ <span class="code-keyword">public</span> setId(<span class="code-object">String</span> id){<span class="code-keyword">this</span>.id = id; }
+}</pre>
+</div></div>
+<p>Now that we have an action defined with a simple model, lets setup an action proxy and execute the action. <br/>
+Setting up XWork to execute the action:</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-comment">// obtain inputs from the caller. For <span class="code-keyword">this</span> example, we can just define some dummy params.
+</span>Map paramMap = <span class="code-keyword">new</span> HashMap();
+paramMap.put(<span class="code-quote">"id"</span>, <span class="code-quote">"0123456789"</span>);
+
+<span class="code-comment">// set the ActionContext parameters
+</span>Map context = <span class="code-keyword">new</span> HashMap();
+context.put(ActionContext.PARAMETERS, paramMap);
+
+<span class="code-comment">// create an action proxy with no namespace, action alias (defined in xwork.xml), and a map of the context info
+</span>ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(<span class="code-quote">"","</span>viewBook", context);
+
+<span class="code-comment">// we have the action proxy instance, lets execute it and retrieve the action
+</span><span class="code-object">String</span> result = proxy.execute();
+<span class="code-keyword">if</span> (<span class="code-quote">"success"</span>.equals(result)){
+ ViewBookAction action = (ViewBookAction) proxy.getAction();
+
+ <span class="code-comment">// <span class="code-keyword">return</span> info back to caller or just print to screen <span class="code-keyword">for</span> <span class="code-keyword">this</span> example
+</span> <span class="code-object">System</span>.out.println(action.getBook().getTitle());
+} <span class="code-keyword">else</span> <span class="code-keyword">if</span>(<span class="code-quote">"notFound"</span>.equals(result){
+ <span class="code-comment">// forward to another inventory source
+</span>} <span class="code-keyword">else</span> {
+ <span class="code-keyword">throw</span> <span class="code-keyword">new</span> RuntimeException(<span class="code-quote">"Im lazy"</span>);
+}</pre>
+</div></div>
+<p>Not quite done yet, we need to define some configuration in xwork.xml so XWork can find the appropriate class to execute based on the action alias we provided within the createActionProxy(...) method.</p>
+
+<div class="code" style="border-style: solid; "><div class="codeHeader" style="border-bottom-style: solid; "><b>xwork.xml</b></div><div class="codeContent">
+<pre class="code-java"><xwork>
+ <include file=<span class="code-quote">"xwork-<span class="code-keyword">default</span>.xml"</span>/>
+ <<span class="code-keyword">package</span> name=<span class="code-quote">"<span class="code-keyword">default</span>"</span> <span class="code-keyword">extends</span>=<span class="code-quote">"xwork-<span class="code-keyword">default</span>"</span>>
+ <action name=<span class="code-quote">"viewBook"</span> class=<span class="code-quote">"com.opensymphony.xwork.example.ViewBookAction"</span>/>
+ </<span class="code-keyword">package</span>>
+</xwork></pre>
+</div></div>
+
+<h2><a name="XWorkFeatures-Next%3AXWorkCoreConcepts"></a>Next: <a href="XWork Core Concepts.html" title="XWork Core Concepts">XWork Core Concepts</a></h2>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Features.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Features.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Features_attachments/Drawing1.gif
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Features_attachments/Drawing1.gif?rev=894087&view=auto
==============================================================================
Binary file - no diff available.
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Features_attachments/Drawing1.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/xwork/trunk/docs/wikidocs/XWork Hibernate Integration.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Hibernate%20Integration.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Hibernate Integration.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Hibernate Integration.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,66 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Hibernate Integration
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <p>XWork2 could have Hibernate integration as well. However such an integration is not build in by default. In other words, it doesn't come bundled with XWork2 itself.</p>
+
+<h3><a name="XWorkHibernateIntegration-Senario"></a>Senario</h3>
+<p>Typical senario would be to have Hibernate session prepared before the action is actually executed and clear after the action and result are done executing. This could be handled by a XWork2 interceptor.</p>
+
+
+<h3><a name="XWorkHibernateIntegration-Code"></a>Code</h3>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">public</span> class HibernateInterceptor <span class="code-keyword">implements</span> Interceptor {
+ ...
+ <span class="code-keyword">public</span> <span class="code-object">String</span> intercept(ActionInvocation invocation) <span class="code-keyword">throws</span> Exception {
+ Session session = <span class="code-keyword">null</span>;
+ <span class="code-keyword">try</span> {
+ <span class="code-comment">// please refer to Hibernate site <span class="code-keyword">for</span> imlpementation of HibernateUtil (www.hibernate.org)
+</span> session = HibernateUtil.getSessionFactory().getCurrentSession();
+ session.beginTransaction();
+ <span class="code-object">Object</span> action = invocation.getAction();
+ <span class="code-keyword">if</span> (action <span class="code-keyword">instanceof</span> HibernateSessionAware) {
+ ((HibernateSessionAware) action).setHibernateSession(session);
+ }
+ invocation.invoke();
+ session.getTransaction().commit();
+ }
+ <span class="code-keyword">catch</span>(Exception e) {
+ exceptionHandler(e);
+ session.getTransaction().rollback();
+ }
+ }
+ ...
+ /**
+ * Hook <span class="code-keyword">for</span> subclass to handle exception.
+ */
+ <span class="code-keyword">protected</span> void handleException(e) {
+ <span class="code-comment">// maybe we could <span class="code-keyword">do</span> better than <span class="code-keyword">this</span>.
+</span> LOG.error(e.toString(), e);
+ }
+ ...
+ }</pre>
+</div></div>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">public</span> <span class="code-keyword">interface</span> HibernateSessionAware {
+ void setHibernateSession(Session session);
+ }</pre>
+</div></div>
+
+<p>The above is just a simple code to show one possibility of how Hibernate / XWork2 integration could be done.</p>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Hibernate Integration.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Hibernate Integration.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Installation.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Installation.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Installation.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Installation.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,99 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Installation
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <table cellpadding='5' width='85%' cellspacing='8px' class='noteMacro' border="0" align='center'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="./icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>
+<p> XWork2 works best with at least JDK 5 (Tiger), but it also ships with a Java 1.4-compatible jar built using <a href="http://retrotranslator.sourceforge.net/" title="Visit page outside Confluence">RetroTranslator</a>.</p>
+</td></tr></table>
+<p>To start using XWork2, it is required to have the folloing in the classpath :-</p>
+<ul>
+ <li>XWork2 jar</li>
+ <li>xwork.xml</li>
+ <li><a href="XWork Requirements And Dependencies.html" title="XWork Requirements And Dependencies">Other jar dependencies</a></li>
+</ul>
+
+
+<h2><a name="XWorkInstallation-Usingcommandline"></a>Using command line</h2>
+
+<p>Assuing the following structure.</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java">+ classes/
+ + xwork2-xxx.jar
+ + xwork.xml
+ + otherJars.jar
+ + myPackage/
+ + MyMain.class</pre>
+</div></div>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-comment">// Linux / Unix like environment
+</span> java -cp xwork-xxx.jar:xwork.xml:otherJars.jar myPackage.MyMain
+
+ <span class="code-comment">// Windows
+</span> java -cp xwork-xxx.jar;xwork.xml;ohterJars.jar myPackage.MyMain</pre>
+</div></div>
+
+<h2><a name="XWorkInstallation-Usingant"></a>Using ant</h2>
+
+<p>Assuming the following structure</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java">+ src
+ + myPackage
+ + MyMain.java
+ + lib
+ + xwork2-xxx.jar
+ + ... jar
+ + classes
+ + myPackage
+ + MyMain.class
+ + resources
+ + xwork.xml</pre>
+</div></div>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><procject ... >
+ ...
+ <path id=<span class="code-quote">"classpath"</span>>
+ <fileset dir=<span class="code-quote">"lib"</span>>
+ <include name=<span class="code-quote">"**/*.jar"</span>/>
+ </fileset>
+ <pathelement location=<span class="code-quote">"resources"</span>/>
+ </path>
+ ....
+ <target ...>
+ <!-- your target refer to path with id as 'classpath' when necessary -->
+ </target></pre>
+</div></div>
+
+<h2><a name="XWorkInstallation-Usingmaven2"></a>Using maven2</h2>
+
+<p>When using maven2, one might want to have the following dependencies</p>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><pom ...>
+ ....
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ .... other dependencies
+ </dependency>
+ .....
+</pom></pre>
+</div></div>
+
+<h2><a name="XWorkInstallation-Next%3AXWorkRequirementsAndDependencies"></a>Next: <a href="XWork Requirements And Dependencies.html" title="XWork Requirements And Dependencies">XWork Requirements And Dependencies</a></h2>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Installation.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Installation.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Interceptors.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Interceptors.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Interceptors.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Interceptors.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,42 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Interceptors
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <p>Interceptor is a core component with XWork2. XWork2 has been designed with action interception in mind from ground up. Basically and interceptor wrappes around XWork2 Action. It is cappable of influencing the overall result, and hence affecting which result eventually get executed. In the process it have access to XWork2 Action, its proxy (ActionProxy), ActionInvocation etc. such that the interceptor could inspect the internals of XWork2 before comming up with a overall conclusion of what it should do.</p>
+
+<h3><a name="XWorkInterceptors-DefaultinterceptorsthatcomeswithXWork2"></a>Default interceptors that comes with XWork2</h3>
+
+<div class="code"><div class="codeContent">
+<pre class="code-xml"><span class="code-tag"><interceptor name=<span class="code-quote">"timer"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.TimerInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"logger"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.LoggingInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"chain"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.ChainingInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"staticParams"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"params"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.ParametersInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"filterParams"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.ParameterFilterInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"removeParams"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.ParameterRemoverInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"modelDriven"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"</span>/></span>
+<interceptor name=<span class="code-quote">"scopedModelDriven"</span>
+ class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"</span>/>
+<span class="code-tag"><interceptor name=<span class="code-quote">"validation"</span> class=<span class="code-quote">"com.opensymphony.xwork2.validator.ValidationInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"workflow"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"prepare"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.PrepareInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"conversionError"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"alias"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.AliasInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"exception"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor"</span>/></span>
+<span class="code-tag"><interceptor name=<span class="code-quote">"i18n"</span> class=<span class="code-quote">"com.opensymphony.xwork2.interceptor.I18nInterceptor"</span>/></span></pre>
+</div></div>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Interceptors.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Interceptors.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Localization.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Localization.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Localization.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Localization.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,102 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Localization
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <h3><a name="XWorkLocalization-Overview"></a>Overview</h3>
+<p>Any action can indicate that it supports localization by implementing com.opensymphony.xwork.TextProvider. To access a localized message, simply use one of the various getText() method calls.</p>
+
+<p>The default implementation for this is com.opensymphony.xwork.TextProviderSupport, which in turn relies on com.opensymphony.xwork.util.LocalizedTextUtil. Any Action that extends com.opensymphony.xwork.ActionSupport will automatically gain localization support via TextProviderSupport.</p>
+
+<p>In this implementation, when you attempt to look up a message, it attempts to do the following:</p>
+
+<ul>
+ <li>Look for the message in the Action's class hierarchy.
+ <ul>
+ <li>Look for the message in a resource bundle for the class</li>
+ <li>If not found, look for the message in a resource bundle for any interface implemented by the class</li>
+ <li>If not found, get the super-class and repeat from the first sub-step unless the super-class is Object</li>
+ </ul>
+ </li>
+</ul>
+
+
+<ul>
+ <li>If not found and the Action is a ModelDriven Action, then look for the message in<br/>
+the model's class hierarchy (repeat sub-steps listed above).</li>
+</ul>
+
+
+<ul>
+ <li>If not found, look for the message in a child property. This is determined by evaluating the message key as an OGNL expression. For example, if the key is <em>user.address.state</em>, then it will attempt to see if "user" can be resolved into an object. If so, repeat the entire process fromthe beginning with the object's class and <em>address.state</em> as the message key.</li>
+</ul>
+
+
+<ul>
+ <li>If not found, look for the message in the Action's package hierarchy.</li>
+</ul>
+
+
+<ul>
+ <li>If still not found, look for the message in the default resource bundles.</li>
+</ul>
+
+
+
+<h3><a name="XWorkLocalization-DefaultResourceBundles."></a>Default Resource Bundles.</h3>
+
+<p>It is possible to register default resource bundles with XWork via LocalizedTextUtil.addDefaultResourceBundle().</p>
+
+<p>Message lookup in the default resource bundles is done in reverse order of their registration (i.e. the first resource bundle registered is the last to be searched). </p>
+
+<p>By default, one default resource bundle name is registered with LocalizedTextUtil – "com/opensymphony/xwork/xwork-messages" – which is bundled with the XWork jar file to provide system-level message texts.</p>
+
+
+<h3><a name="XWorkLocalization-Example"></a>Example</h3>
+
+<p>Given a ModelDriven Action called BarnAction where getModel() returns a Horse object, and the Horse object has the following class structure:</p>
+
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">interface</span> acme.test.Animal;
+class acme.test.AnimalImpl <span class="code-keyword">implements</span> Animal;
+<span class="code-keyword">interface</span> acme.test.Quadraped <span class="code-keyword">extends</span> Animal;
+class acme.test.QuadrapedImpl <span class="code-keyword">extends</span> Animal <span class="code-keyword">implements</span> Quadraped;
+class acme.test.Horse <span class="code-keyword">extends</span> QuadrapedImpl;</pre>
+</div></div>
+
+<p>Then the localization system will attempt to look up the message in the following resource bundles in this order:</p>
+
+<div class="preformatted"><div class="preformattedContent">
+<pre>acme.test.BarnAction.properties
+acme.test.Horse.properties
+acme.test.QuadrapedImpl.properties
+acme.test.Quadraped.properties
+acme.test.AnimalImpl.properties
+acme.test.Animal.properties
+acme.test.package.properties
+acme.package.properties
+</pre>
+</div></div>
+
+
+<h2><a name="XWorkLocalization-MessageKeyInterpolation"></a>Message Key Interpolation</h2>
+
+<p>When looking for the message, if the key indexes a collection (e.g. user.phone0) and a message for that specific key cannot be found, the general form will also be looked up (i.e. user.phone\*).</p>
+
+<h2><a name="XWorkLocalization-MessageInterpolation"></a>Message Interpolation</h2>
+
+<p>If a message is found, it will also be interpolated. Anything within <b>${...}</b> will be treated as an OGNL expression and evaluated as such.</p>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Localization.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Localization.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork Object Factory.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20Object%20Factory.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork Object Factory.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork Object Factory.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,30 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork Object Factory
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <p>ObjectFactory is an abstraction from XWork2 responsible for all the creation of XWork2 related objects. Its how XWork2 integrate with IoC containers like Spring, Pico, Plexus etc.</p>
+
+<h2><a name="XWorkObjectFactory-Customization"></a>Customization</h2>
+
+<p>To customize an ObjectFactory, you will need to create a subclass of ObjectFactory, then tell XWork to use it in the configuration. To configure your ObjectFactory in <tt>xwork.xml</tt>, declare your custom ObjectFactory implementation:</p>
+
+<div class="code"><div class="codeContent">
+<pre class="code-xml"><span class="code-tag"><bean name=<span class="code-quote">"default"</span> type=<span class="code-quote">"com.opensymphony.xwork2.ObjectFactory"</span> class=<span class="code-quote">"com.mycompany.MyObjectFactory"</span> /></span></pre>
+</div></div>
+
+<p>Now, XWork will use your ObjectFactory instead of the default implementation.</p>
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Object Factory.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork Object Factory.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: struts/xwork/trunk/docs/wikidocs/XWork PreResultListeners.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/docs/wikidocs/XWork%20PreResultListeners.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/docs/wikidocs/XWork PreResultListeners.html (added)
+++ struts/xwork/trunk/docs/wikidocs/XWork PreResultListeners.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1,57 @@
+<html>
+ <head>
+ <title>XWork -
+ XWork PreResultListeners
+ </title>
+ <link rel="stylesheet" href="styles/site.css" type="text/css" />
+ <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+
+ <body>
+ <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+ <tr>
+ <td valign="top" class="pagebody">
+ <p>PreResultListener serves as a hook to influence the currect action invocation before the result is executed, pretty much clear from the name itself.</p>
+
+<h2><a name="XWorkPreResultListeners-Example"></a>Example</h2>
+<h3><a name="XWorkPreResultListeners-ThroughActionclass"></a>Through Action class</h3>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">public</span> class MyAction <span class="code-keyword">extends</span> ActionSupport {
+ ...
+ <span class="code-keyword">public</span> <span class="code-object">String</span> execute() <span class="code-keyword">throws</span> Exception {
+ ActionContext context = ActionContext.getContext();
+ ActionInvocation invocation = context.getActionInvocation();
+ invocation.addPreResultListener(
+ <span class="code-keyword">new</span> PreResultListener() {
+ <span class="code-keyword">public</span> void beforeResult(ActionInvocation invocation, <span class="code-object">String</span> resultCode) {
+ <span class="code-comment">// <span class="code-keyword">do</span> my magic here
+</span> }
+ });
+ }
+ ...
+ }</pre>
+</div></div>
+
+<h3><a name="XWorkPreResultListeners-ThroughInterceptorclass"></a>Through Interceptor class</h3>
+<div class="code"><div class="codeContent">
+<pre class="code-java"><span class="code-keyword">public</span> MyInterceptor <span class="code-keyword">implements</span> Interceptor {
+ ....
+ <span class="code-keyword">public</span> <span class="code-object">String</span> intercept(ActionInvocation invocation) <span class="code-keyword">throws</span> Exception {
+ invocation.addPreResultListener(
+ <span class="code-keyword">new</span> PreResultListener() {
+ <span class="code-keyword">public</span> void beforeResult(ActionInvocation invocation, <span class="code-object">String</span> resultCode) {
+ <span class="code-comment">// <span class="code-keyword">do</span> my magic here
+</span> }
+ });
+ }
+ ....
+ }</pre>
+</div></div>
+
+
+
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
Propchange: struts/xwork/trunk/docs/wikidocs/XWork PreResultListeners.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/xwork/trunk/docs/wikidocs/XWork PreResultListeners.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL