You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Greg Maletic <gr...@ZeroG.com> on 2001/07/27 01:27:19 UTC

Errors from within Action.perform()

Struts encourages two different ways to do form validation:  inside the
ActionForm.validate() method (presumably for low-level field validation) and
in the Action.perform() method (presumably for higher-level business logic
validation).  ActionForm.validate() lets me return an ActionError object
that displays error messages on the JSP.  Is there a way for me to leverage
this same error architecture from within my Action.perform() method?

In other words, how can I generate error messages in my Action that will
display on the JSP, in exactly the same way that errors from my
ActionForm.validate() method can?  Is it somehow possible to generate an
ActionErrors object from inside an Action.perform() method?

Thanks.

======================================
Greg Maletic
Chief Technical Officer
Zero G Software, Inc.
514 Bryant Street
San Francisco, CA 94107

tel: +1.415.512.7771 x303
fax: +1.415.723.7244
mailto:greg@ZeroG.com
http://www.ZeroG.com

The leading provider of multi-platform software deployment solutions.
======================================


RE: Errors from within Action.perform()

Posted by Greg Maletic <gr...@ZeroG.com>.
Thanks.  Somehow I missed the "saveErrors()" method in the Action class, but
that looks like it will do what I want.
  -----Original Message-----
  From: struts-user-return-14145-greg.maletic=zerog.com@jakarta.apache.org
[mailto:struts-user-return-14145-greg.maletic=zerog.com@jakarta.apache.org]O
n Behalf Of Rama Krishna
  Sent: Thursday, July 26, 2001 4:49 PM
  To: struts-user@jakarta.apache.org; greg.maletic@ZeroG.com
  Subject: Re: Errors from within Action.perform()


  this should work.

  this is also there in struts example  "SaveRegistrationAction"

   errors.add("somestring",
                             new ActionError("error.key"));
   }

   if (!errors.empty()) {
       saveErrors(request, errors);
       return (new ActionForward(mapping.getInput()));
   }

  hope this helps

    ----- Original Message -----
    From: Greg Maletic
    To: struts-user@jakarta.apache.org
    Sent: Thursday, July 26, 2001 4:27 PM
    Subject: Errors from within Action.perform()


    Struts encourages two different ways to do form validation:  inside the
ActionForm.validate() method (presumably for low-level field validation) and
in the Action.perform() method (presumably for higher-level business logic
validation).  ActionForm.validate() lets me return an ActionError object
that displays error messages on the JSP.  Is there a way for me to leverage
this same error architecture from within my Action.perform() method?

    In other words, how can I generate error messages in my Action that will
display on the JSP, in exactly the same way that errors from my
ActionForm.validate() method can?  Is it somehow possible to generate an
ActionErrors object from inside an Action.perform() method?

    Thanks.

    ======================================
    Greg Maletic
    Chief Technical Officer
    Zero G Software, Inc.
    514 Bryant Street
    San Francisco, CA 94107

    tel: +1.415.512.7771 x303
    fax: +1.415.723.7244
    mailto:greg@ZeroG.com
    http://www.ZeroG.com

    The leading provider of multi-platform software deployment solutions.
    ======================================


Re: Errors from within Action.perform()

Posted by Rama Krishna <kr...@hotmail.com>.
this should work.

this is also there in struts example  "SaveRegistrationAction"

 errors.add("somestring",
                           new ActionError("error.key"));
 }

 if (!errors.empty()) {
     saveErrors(request, errors);
     return (new ActionForward(mapping.getInput()));
 }

hope this helps

  ----- Original Message ----- 
  From: Greg Maletic 
  To: struts-user@jakarta.apache.org 
  Sent: Thursday, July 26, 2001 4:27 PM
  Subject: Errors from within Action.perform()


  Struts encourages two different ways to do form validation:  inside the ActionForm.validate() method (presumably for low-level field validation) and in the Action.perform() method (presumably for higher-level business logic validation).  ActionForm.validate() lets me return an ActionError object that displays error messages on the JSP.  Is there a way for me to leverage this same error architecture from within my Action.perform() method?
   
  In other words, how can I generate error messages in my Action that will display on the JSP, in exactly the same way that errors from my ActionForm.validate() method can?  Is it somehow possible to generate an ActionErrors object from inside an Action.perform() method?  
   
  Thanks.
   
  ======================================
  Greg Maletic
  Chief Technical Officer
  Zero G Software, Inc.
  514 Bryant Street
  San Francisco, CA 94107
   
  tel: +1.415.512.7771 x303
  fax: +1.415.723.7244
  mailto:greg@ZeroG.com
  http://www.ZeroG.com
   
  The leading provider of multi-platform software deployment solutions.
  ======================================