Instead of 
if (errors.size() > 0) {
        request.setAttribute("org.apache.struts.action.ERROR", errors);
        forward = "failure";
}

I would write :
if (! errors.isEmpty()) {
        saveErrors(request, errors);
        forward="failure";
}

Le mar 07/10/2003 à 16:27, Glenn Holmer a écrit :
> Frederic Dernbach wrote:
> > Glenn,
> > 
> > - Use a descendant of DispatchAction for your form's action,
> > - Have two separate methods in the action class for your two buttons
> > (one for 'commit' and one for 'cancel').
> > - In the struts-config.xml file, specify attribute 'validate' to 'false'
> > for your form's action.The form validation wont't happen automatically
> > this way.
> > - In the method for the 'commit' button, call explicitely 'validate' on
> > your form. But not in the method associated to the cancel button.
> 
> Thanks, I got that to work without resorting to a DispatchAction
> like this:
> 
>      if (confirm.equals(cancel)) {
>        forward = "complete";
>      } else {
>        errors = dynaForm.validate(mapping, request);
>        if (errors.size() > 0) {
>          request.setAttribute("org.apache.struts.action.ERROR", errors);
>          forward = "failure";
>        }
>      }
> 
> Is that the right way to put the errors in play?
> 
> -- 
> ____________________________________________________________
> Glenn Holmer                          [EMAIL PROTECTED]
> Programmer/Analyst                       phone: 414.908.1809
> Weyco Group, Inc.                          fax: 414.908.1601
> 
> 
> ---------------------------------------------------------------------
> 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