...
Attribute | Required | Description |
---|---|---|
name | yes | key to for other packages to reference |
extends | no | inherits package behavior of the package it extends |
namespace | no | see Namespaces |
abstract | no | declares package to be abstract (no action configurations required in package) |
...
Sample usage of
...
packages in xwork.xml
Code Block |
---|
<package name="bar" extends="webwork-default" namespace="/foo/bar">
<interceptors>
<interceptor-stack name="barDefaultStack">
<interceptor-ref name="debugStack"/>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
<action name="Bar" class="com.opensymphony.xwork.SimpleAction">
<interceptor-ref name="barDefaultStack"/>
</action>
<action name="TestInterceptorParamInheritance" class="com.opensymphony.xwork.SimpleAction">
<interceptor-ref name="test">
<param name="expectedFoo">expectedFoo</param>
</interceptor-ref>
</action>
<action name="TestInterceptorParamInehritanceOverride" class="com.opensymphony.xwork.SimpleAction">
<interceptor-ref name="test">
<param name="foo">foo123</param>
<param name="expectedFoo">foo123</param>
</interceptor-ref>
</action>
</package>
<package name="abstractPackage" namespace="/abstract" abstract="true">
<action name="test" class="com.opensymphony.xwork.SimpleAction"/>
</package>
<package name="nonAbstractPackage" extends="abstractPackage" namespace="/nonAbstract"/>
<package name="baz" extends="default" namespace="baz">
<action name="commandTest" class="com.opensymphony.xwork.SimpleAction">
<param name="foo">123</param>
<result name="error" type="chain">
<param name="actionName">bar</param>
</result>
<interceptor-ref name="static-params"/>
</action>
<action name="myCommand" class="com.opensymphony.xwork.SimpleAction" method="commandMethod">
<param name="bar">456</param>
<result name="success" type="chain">
<param name="actionName">foo</param>
</result>
<interceptor-ref name="logger"/>
</action>
</package>
<package name="multipleInheritance" extends="default,abstractPackage,bar" namespace="multipleInheritance">
<action name="testMultipleInheritance" class="com.opensymphony.xwork.SimpleAction">
<result name="success" type="chain">
<param name="actionName">foo</param>
</result>
<interceptor-ref name="barDefaultStack"/>
</action>
</package>
|