I think so, look at this. http://www.learntechnology.net/validate-manually.do My implementation down here.
/*** CODE *** /** * This method is used to execute validation rules <br> * The good-part, * <br>1. can chose to not validate if cancel is submitted . * <br>2. If validate exception is found the Form/Page can be reInitialized and shown properly again. * <br> * The bad-part, normaly the user sets validate="true" in config but this * can no longer be done, can feel strange. <br> * This method is used with recommendation from --> <br> * see http://www.learntechnology.net/validate-manually.do * * @author robert.alexandersson * * Generic Struts stuff - cancel - validate */ public ActionForward validate(ActionMapping mapping, ActionForm form, HttpServletRequest request) { if (this.isDelete(request) || this.isCancel(request)) return null; ActionErrors errors = form.validate(mapping, request); if (errors != null && !errors.isEmpty()) { saveErrors(request, logAndGetMessages(errors)); return (mapping.getInputForward()); } return null; } /** * Transform Errors to Messages according to the Deprecation warning in * ActionErrors and super.saveErrors * * @param errors * @return */ private ActionMessages logAndGetMessages(ActionErrors errors) { Iterator i = errors.properties(); ActionMessages messages = new ActionMessages(); while (i.hasNext()) { String property = (String) i.next(); Iterator j = errors.get(property); while (j.hasNext()) { ActionMessage err = (ActionMessage) j.next(); messages.add(property, err); } } return messages; } /******* END CODE ******* Regards Robert -----Original Message----- From: Tom Ansley [mailto:[EMAIL PROTECTED] Sent: Saturday, February 11, 2006 6:48 AM To: Struts Users Mailing List Subject: Bean Population When Form Cancelled Hi all, I have a form that uses validator to check for simple validation like making sure that a cash amount is a double. I have the "cancel" button on the form set so that if it is pressed that validation does not take place. This is great except when you type a letter into the cash text box and then press cancel. The form gets returned along with the invalid cash amount, the BeanUtils attempts to populate the form and the whole thing falls over with an exception. Does somebody have a strategy for dealing with this situation? Is there a way of telling struts that if the cancel button is pressed that NO bean population should take place? All help appreciated. Cheers Tom --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]