>> You can declare your different interceptor stacks in different
>> packages and then declare the parent package on the action like
>> this:

>> @ParentPackage("packageWithEmptyStack")
>> public class FooAction ...

Guillaume is right. In 2.0.x when Actions are auto-discovered (via the
actionPackages parameter on the FilterDispatcher in web.xml) we have no
way of customizing the xwork package that they are put in.

Instead, you can do exactly what Guillaume suggested, and define an
xwork package with the interceptors that you want to use in struts.xml:

    <package name="custom-xwork-package" extends="struts-default">
        <interceptors>
            <interceptor-stack name="customizedDefaultStack">
                <interceptor-ref name="defaultStack"/>
                <interceptor-ref name="myCustomInterceptor"/>
            </interceptor-stack>
        </interceptors>
        
        <default-interceptor-ref name="customizedDefaultStack"/>
    </package>

Then use the @ParentPackage("custom-xwork-package") on Action's that you
want this to apply to.

In Struts 2.1 with the convention plugin [1], it looks like we will be
able to customize the xwork package which auto-discovered Actions are
put in, so then you wouldn't need the @ParentPackage annotation.

[1] convention plugin (requires Struts 2.1):
http://cwiki.apache.org/S2PLUGINS/convention-plugin.html

Brad Cupit
Louisiana State University - UIS

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to