Action
The <action> tag can use any type of object, by default, it will call the execute method, you can override this by specifying a value for the "method" attribute, also, use "actionName!methodName" to force to invoke a public method in action.
If the "class" attribute is not specified, "ActionSupport" will be used.
You can define a default action inside a package which will be executed when no match is found.
ActionProxy,ActionInvocation,ActionContext
Result
<result name="success" type="dispatcher">
<param name="location">/thank_you.jsp</param>
</result>
The default value for "name" attribute is "success", the default value for "type" is "dispatcher", and if there's no <param> tag to specify "location", the text inside <result> tag will be set to "location" attribute.
Interceptor,InterceptorStack,PreResultListener(should be add to ActionInvocation programatically)
Package, what's the usage of abstract and extend? When marked with "abstract", a package's action definition will not be inherit by it's child package?
Package is used to group actions into namespace (think of it as context path in webapp), so that different actions are invoked by different context path prefix ("/some.do", "/myapp/some.do") and share the same action alias.
A default namespace is empty string "", which will be used as fallback namespace, when not able to find action in a certain package, package with default namespace will be searched.
A root namespace is "/", which means that context path is empty.
In contrast to package namespace, package name is used for action reference.
Use <include file="xwork-default.xml"/> to include configuration file.
ValueStack, evaluate expression from head to tail, both ActionInvocation, ActionContext and Validator refer to ValueStack, ParametersInterceptor gets parameters from ActionContext and put them into ValueStack.
<action name="helloWorld" class="com.opensymphony.xwork2.showcase.helloworld.HelloWorldAction">
<result type="printToConsole">
<param name="param">${message}</param>
</result>
</action>
String result = TextParseUtil.translateVariables(param, invocation.getStack());
How to get action's message property inside result? StrutsResultSupport dose this by default?
For Global level, put a 'xwork-conversion.properties' in classpath, use <class name>=<converter class name>
For Action level, put a 'ActionClassName-conversion.properties' in the same folder as action class, use <property name>=<converter class name>
How dose a converter work?
Validator validate an object and put error message in ValidatorContext.
ValidatorSupport's getFieldValue method pushes given object to ValueStack, and calls ValueStack's findValue method.
Put xml in the same folder of action class, use 'ActionClass-validation.xml' for action-level and use 'ActionClass-actionAlias-validation.xml' for action alias-level.
Set system property using UtilTimerStack.ACTIVATE_PROPERTY or UtilTimerStack.MIN_TIME as key, or manipulate on UtilTimerStack to control profiling.
Use AnnotationWorkflowInterceptor and mark @before, @after or @beforeResult in action class's method.
Use XWork-tiger to enable annotation for validation and conversion.
XWork has added some new features to OGNL, including support for ValueStack, statics properties and the "top" keyword.
TextProvider is used to resolve key to messages in properties file by calling it's getText() method, ActionSupport has implemented this interface.
ObjectFactory
Integrate with Spring, use SpringObjectFactory implementation, now the "class" attribute is set to a bean name in spring configuration file, use "singleton"=false.
Use <bean name="default" type="com.opensymphony.xwork2.ObjectFactory" class="com.mycompany.MyObjectFactory" /> to use custom implementation.
Ognl expression is evaluated against ValueStack, when will values be pushed into ValueStack?