Versions Compared

Key

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

Update formatting

...

The action-default package defines result types for the Results provided with the framework. If your package uses a custom result type, you can add it to your package.

types.

Code Block
xml
xml
1titleaction.xml
<xwork>
   <include name="action-default.xml"/>
   <package name="default" extends="action-default">

      <result-types>
        <result-type name="image" class="tutorial.ImageResult" />
      </result-types>

      <action name="image" class="tutorial.ImageAction">
        <result name="success" type="image"/>
     </action>
   </package>
</xwork>

...

Another way to reduce the amount of configuration in the action.xml is through the use of global result mappings. Web applications often have a common set of results that are used across many action mappings. Common results include redirects to login actions and permission-denied pages. Rather than define each of these results in every action mapping, the framework lets you centralize the definitions for the common pages.

Code Block
xml
xml
titleaction.xml
<package name="default" extends="webwork-default">
   <global-results>
      <result name="login"
         type="redirect">/login!default.action</result>
      <result name="unauthorized">/unauthorized.jsp</result>
   </global-results>
   <!-- other package declarations -->
</package>

...