Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## examples
Class SuccessAction

    java.lang.Object
      org.apache.struts.action.Action
          examples.SuccessAction

    public class SuccessAction

extends Action

An Action that forwards control via a "success" ActionFoward.

A recommended strategy is that view pages should link only to Actions and never directly to other views. In situations where the view does not require any preparation you can use a SuccessAction, specifying the view as an ActionForward named "success" in your action mapping.

e.g. If you configure an ActionMapping in struts-config.xml like this:

        <action path="/prepareView"
                type="examples.SuccessAction">
            <forward name="success" path="/jsp/View.jsp"/>
        </action>

You could create a link to the view (via the Action) as follows:

         <html:link action="/prepareView">Display 'view' page</html:link>

If you later change your application such that the view page requires some initialization you can change a single ActionMapping definition in struts-config.xml rather than lots of link definitions in many JSPs.

Version:
  $Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $

Field Summary

Fields inherited from class org.apache.struts.action.Action
`servlet`

Constructor Summary
`SuccessAction()` Constructor for SuccessAction.

Method Summary
`ActionForward` | `execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)` Returns the `ActionForward` named "success" if one is configured or `null`if it cannot be found.

Methods inherited from class org.apache.struts.action.Action
`addErrors, addMessages, execute, generateToken, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SuccessAction

    public SuccessAction()

  Constructor for SuccessAction.

Method Detail

### execute

    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
                          throws Exception

  Returns the `ActionForward` named "success" if one is configured or `null`if it cannot be found. Searches first for a local forward, then a global forward.

  Overrides:
    `execute` in class `Action`
  Parameters:
    `mapping` - The ActionMapping used to select this instance
    `form` - The optional ActionForm bean for this request (if any)
    `request` - The HTTP request we are processing
    `response` - The HTTP response we are creating
  Returns:
    the "success" ActionForward, or null if it cannot be found
  Throws:
    `Exception` - if mapping.findForward throws an Exception

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.