Sure ... just create the ActionErrors in your Action, save them using saveErrors(), then return the InputForward() ....

public class SaveDataAction extends Action {
  public ActionForward execute(ActionMapping mapping, ActionForm form,
                        HttpServletRequest request,
                        HttpServletResponse response)
        throws Exception {
    ActionErrors errors = new ActionErrors();
    // do stuff with request params here

    // here is the ActionError stuff
    if ( somethingIsWrong() ) {
      errors.add(ActionErrors.GLOBAL_MESSAGE,
                 new ActionError("error.token"));
     // etc.
    }
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return new ActionForward(mapping.getInputForward());
    }
    return mapping.findForward("success");
  }
}


[EMAIL PROTECTED] wrote:


Currently constrained to Struts 1.0.

Due to the nature of my application, I am unable to use an ActionForm to hold my form data (I am pulling it directly from the request parameter map in the action). As a result, I have to perform my validation in the action, and I'm wondering if there is some way to leverage ActionErrors from my action, or should I just use an application exception?

Dennis


------------------------------------------------------------------------

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


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



Reply via email to