Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" "http://www.opensymphony.com/xwork/xwork-1.1.dtd">
 
<xwork>
    <!-- Include webwork defaults (from WebWork JAR). -->
    <include file="webwork-default.xml"/>
    
    <!-- Configuration for the default package. -->
    <package name="default" extends="webwork-default">
        <action name="listPeople" class="com.acme.ListPeople">
            <result type="freemarker">listPeople.ftl</result>
        </action>

        <action name="newPerson" class="com.acme.CreatePerson">
            <result type="redirect">listPeople.action</result>
            <result name="input" type="freemarker">newPerson.ftl</result>
        </action>
    </package>
</xwork>

...

With most web applications, you'll find yourself wanting to apply the same interceptors over and over. Rather than declare numerous interceptor-refs for each action, you can bundle these interceptors together using an interceptor stack.

Code Block
xml
xml
titleGrouping interceptors as stacks

<package name="default" extends="webwork-default">
   <interceptors>
        <interceptor name="timer" class=".."/>
        <interceptor name="logger" class=".."/>
        <interceptor-stack name="myStack">
           <interceptor-ref name="timer"/>
           <interceptor-ref name="logger"/>
        </interceptor-stack>
    </interceptors>

<action name="login"
     class="org.hibernate.auction.web.actions.users.Login">
         <interceptor-ref name="myStack"/>
         <result name="input">login.jsp</result>
         <result name="success"
             type="redirect">/secure/dashboard.action</result>
</action>
</package>

Looking inside webwork-default.xml we can see how it's done:

...