struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <strut...@reumann.net>
Subject Re: Request bean is lost
Date Wed, 07 Jul 2004 02:07:53 GMT
gdeschen@cmhc-schl.gc.ca wrote:

> I have an action Page.do that gets 3 lists from a database.
> It then places the lists inside a bean which is set in the request.
> The Page.jsp iterates thru the bean to display the data.
> 
> The form is posted to the PageSubmit.do.
> But before the PageForm.validate() is executed.
> Assume that an error is found...
> The response is returned 
> 
> And this is where my bean is lost.
> Why?

(As mentioned your form bean won't be lost but the lists you put into 
the request would be. That's the nature of the request/response lifecycle).

> I do not want to store thr bean in the HTTP Session.

This is why I'm not so fond of the way Struts handles default validation 
with the validation framework - this problem comes up all the time in an 
application. In a case like this, I would opt for not having 
validate="true" in your config file for this action, and in instead 
manually call the validate method in your action. Then if validation 
fails you can make a query to yoru dao to return your Lists and forward 
back to the page. Probably best if you had a setUp() method in your 
Action which can be called to do this setup. You'd call it of course the 
first time you need to present the form, and then after manually calling 
the validate() method on the form, and validation fails, you'd call it 
again.

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message