--- Matt Raible <[EMAIL PROTECTED]> wrote:
> It's one of those days... As soon as I send something to this list, I
> figure it out.  The problem was my validationFailed forward was not
> resetting the "action" parameter for my dispatch action and it was
> hitting save even when it failed.  I change the "input" attribute to
> "edit" (removing the validationFailed forward) and it solved my problem.
> 
> If you're reading these - thanks for putting up with me. ;0)

I try to read all validator related posts and yours have been quite
entertaining ;-).  Thanks for testing 1.2.0!

David

> 
> Matt
> 
> > -----Original Message-----
> > From: Matt Raible [mailto:[EMAIL PROTECTED] 
> > Sent: Saturday, February 28, 2004 1:56 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: Validation working, but not stopping action from processing
> > 
> > 
> > I'm using the 1.2.0 test build on Windows XP.
> > 
> > I have the following XDoclet-generated action-mapping:
> > 
> >     <action
> >       path="/savePerson"
> >       type="org.appfuse.webapp.action.PersonAction"
> >       name="personForm"
> >       scope="request"
> >       input="validationFailed"
> >       parameter="action"
> >       unknown="false"
> >       validate="true"
> >     >
> >       <forward
> >         name="validationFailed"
> >         path="/editPerson.do"
> >         redirect="false"
> >       />
> >       <forward
> >         name="edit"
> >         path=".personDetail"
> >         redirect="false"
> >       />
> >     </action>
> > 
> > When I click on a button to "save" my form, the validation 
> > kicks in - but it let's my Action continue to execute.  I 
> > thought that any validation errors were supposed to call 
> > mapping.getInputForward()?  Is that correct?  I'm stumped.  
> > Here's my save() method:
> > 
> >     public ActionForward save(ActionMapping mapping, ActionForm form,
> >                               HttpServletRequest request,
> >                               HttpServletResponse response)
> >     throws Exception {
> >         if (log.isDebugEnabled()) {
> >             log.debug("Entering 'save' method");
> >         }
> > 
> >         // Extract attributes and parameters we will need
> >         ActionMessages messages = getMessages(request);        
> >         PersonForm personForm = (PersonForm) form;
> >         boolean isNew = ("".equals(personForm.getId()));
> >         
> >         if (log.isDebugEnabled()) {
> >             log.debug("saving person: " + personForm);
> >         }
> > 
> >         // Exceptions are caught by ActionExceptionHandler
> >         PersonManager mgr = (PersonManager) getBean("personManager");
> >         personForm = (PersonForm) mgr.savePerson(personForm);
> > 
> >         // add success messages
> >         if (isNew) {
> >             messages.add(ActionMessages.GLOBAL_MESSAGE,
> >                          new ActionMessage("person.added",
> >                                            
> > personForm.getFirstName() + " " +
> >                                            personForm.getLastName()));
> >             
> > request.getSession().setAttribute(Globals.MESSAGE_KEY, messages);
> > 
> >             return mapping.findForward("mainMenu");
> >         } else {
> >             messages.add(ActionMessages.GLOBAL_MESSAGE,
> >                          new ActionMessage("person.updated",
> >                                            
> > personForm.getFirstName() + " " +
> >                                            personForm.getLastName()));
> >             saveMessages(request, messages);
> > 
> >             return mapping.findForward("edit");
> >         }
> >     }
> > 
> > The validation routes the user back to the form, but it also 
> > calles mgr.savePerson and puts the message in the requestion. 
> >  So on my page, I end up with the following messages:
> > 
> > 'First Name' is a required field.
> > 'Last Name' is a required field.
> > Information for has been updated successfully.
> > 
> > Hopefully I'm just banging my head against the wall and it's 
> > something simple...
> > 
> > Matt
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools

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

Reply via email to