oops, you could be right. I left that out when I was genericising my action tag... just trying to make it more generic.
However, my point is still that when validate fails then the errors will not be empty... that is where your action tells struts to forward as: > forward = mapping.findForward("failure"); and in your struts entry you can see (in my example) that "failure" is defined as the same form (but it could be anything) an example of this is in the sample struts project in the struts tutorial where the login screen forwards to "welcome" if login was okay, or back to "login" if it failed. so I'm not sure if the input parameter is responsible for the forward... it could be the default? Cheers, Heya Gosper CSC Australia 212 Northbourne Ave, Braddon ACT 2612 Ph: +61 (0) 2 6246 8155 Fax: +61 (0) 2 62468100 MOB: 0401 611779 ---------------------------------------------------------------------------------------- This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. ---------------------------------------------------------------------------------------- Paul Barry <[EMAIL PROTECTED]> 04/02/2004 12:38 PM Please respond to "Struts Users Mailing List" To: [EMAIL PROTECTED] cc: Subject: Re: Re-populating form after validate fails I can't test this right now, but if I have an ActionMapping with validate="true" and no input, won't that result in an error when validate fails? My understanding is that if validate fails, the request processor forwards the request to the input. > ------------------------------------------------------------------------ > > Subject: > Re: Re-populating form after validate fails > From: > [EMAIL PROTECTED] > Date: > Wed, 4 Feb 2004 10:59:35 +1100 > To: > "Struts Users Mailing List" <[EMAIL PROTECTED]> > > > Just set up an forward for validation failure. You can do this in your > struts-config.xml file, in fact you can have as many forwards as you > like, but for practical purposes most people prefer to have at most three > or four forwards per Action. For example, you might have a SaveAction that > forwards to the next screen in a sequence if validation succeeds, an error > page if it fails, a login page if the session becomes invalidated, and a > query action if you had a "delete" button to delete a record. > > Just say you query a database to populate your form fields. Then you can > edit the form and hit Save. In the Form's validate method you fill an > ActionErrors object. > > Then in the SaveAction you will have something like: > > // If a message is required, save the specified key(s) > // into the request for use by the <struts:errors> tag. > if (!errors.isEmpty()) > { > saveErrors(request, errors); > > // Forward control to the appropriate 'failure' URI > forward = mapping.findForward("failure"); > > } > > else > { > // Forward control to the appropriate 'success' URI if no errors > forward = mapping.findForward("success"); > } > > return forward; > > and in your struts-config you will have something like: > > <action path="/saveAction" > type="myproject.actions.SaveAction" > name="somethingForm" > validate="true"> > <forward name="success" path="nextForm/> > <forward name="failure" path="somethingForm"/> > </action> > > > I hope you can figure out your answer from that... I can't give you a real > example from my project because of confidentiality so I have to try and > make it generic. > > > Cheers, > Heya Gosper > CSC Australia > 212 Northbourne Ave, Braddon ACT 2612 > Ph: +61 (0) 2 6246 8155 Fax: +61 (0) 2 62468100 > MOB: 0401 611779 > ---------------------------------------------------------------------------------------- > This is a PRIVATE message. If you are not the intended recipient, please > delete without copying and kindly advise us by e-mail of the mistake in > delivery. NOTE: Regardless of content, this e-mail shall not operate to > bind CSC to any order or other contract unless pursuant to explicit > written agreement or government initiative expressly permitting the use of > e-mail for such purpose. > ---------------------------------------------------------------------------------------- > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ________________________________________________________________________