Versions Compared

Key

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

...

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

Code Block
<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>
Note
titleBe Careful

Because global reseults are searched after local results, you can override any global result
mapping by creating a local result mapping for a specific action. Recall that
results can point to locations using relative or absolute paths. Because you may
not know the context in which they're being invoked, it's best to use absolute
paths for global results.