Hi David, One way to get around the problem would be to store the form bean in the session, or at least the id, and it will exist between requests. You'll just need to make sure your viewUser.do action updates the session variable correctly, and any other actions that use it.
-----Original Message----- From: David Erickson [mailto:[EMAIL PROTECTED] Sent: 19 September 2005 06:51 To: 'Struts Users Mailing List' Subject: RE: Validator woes, modifying the input forward on the fly? > -----Original Message----- > From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper > Sent: Sunday, September 18, 2005 7:26 PM > To: user@struts.apache.org > Subject: Re: Validator woes, modifying the input forward on the fly? > > David Erickson wrote: > > Hi I have a situation like this: > > User clicks on /viewUser.do?id=4 action, which loads the specific user > with > > id4 to be viewed. > > On that page is a form, the form is submitted, if some part of the xml > > validation fails I need to return back to /viewUser.do?id=4. It would > be > > ideal if the information from the form could be retained. I can set my > > input forward to be: input="/viewUser.do" but somehow I need to access > that > > and add the parameter id=4 to it after the xml validation takes place, > but > > before the new page is requested. Is there any possible way to do this? > > The parameter is stored into the request when it is first submitted, so > provided you haven't told Struts to redirect to the input page (it'll > use a forward by default) the parameter -- and any others submitted from > your form -- should still be in the request. So, you shouldn't need to > do anything yourself to have the data available when the input page is > redisplayed. I guess a better explanation is due. Ok the user sees /viewUser.do?id=4 which in my action pulls the User object with ID 4 from the db, places it in to the request, then loads the .viewUser tiles definition and displays the data. In that page is a form that submits to /addEmailAddress.do. If the xml validation fails on submitting it then pulls the input forward from addEmailAddress.do, which I tried setting to input=".viewUser", the tiles definition. After a failure validating, my jsp reports an error finding the user object, because when you submit you are getting a new request, and the user object is no longer loaded into the request object. I also tried setting the input element to be input="/viewUser.do", which runs the action again, but doesn't have the id=4 parameter I need to specify which user object to load out of the database. Make sense? So essentially what I am looking for is a way to modify the input forward that is used when validation fails. I tried this in the validate method of my form, however it says configuration locked if I do a setInput(), and if I do getInputForward then modify it, it doesn't seem to do anything.. (probably returning a copy). So.. if anyone has any ideas.. :) Thanks, David --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] E-Mail Disclaimer Aus Rechts- und Sicherheitsgruenden ist die in dieser E-Mail gegebene Information nicht rechtsverbindlich. Eine rechtsverbindliche Bestaetigung reichen wir Ihnen gerne auf Anforderung in schriftlicher Form nach. Beachten Sie bitte, dass jede Form der unautorisierten Nutzung, Veroeffentlichung, Vervielfaeltigung oder Weitergabe des Inhalts dieser E-Mail nicht gestattet ist. Diese Nachricht ist ausschliesslich fuer den bezeichneten Adressaten oder dessen Vertreter bestimmt. Sollten Sie nicht der vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein, so bitten wir Sie, sich mit dem Absender der E-Mail in Verbindung zu setzen. For legal and security reasons the information provided in this e-mail is not legally binding. Upon request we would be pleased to provide you with a legally binding confirmation in written form. Any form of unauthorised use, publication, reproduction, copying or disclosure of the content of this e-mail is not permitted. This message is exclusively for the person addressed or their representative. If you are not the intended recipient of this message and its contents, please notify the sender immediately. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]