struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Barrows" <jbarr...@sssc.com>
Subject RE: ActionForm in session scope - the best way.
Date Fri, 10 Sep 2004 16:46:33 GMT


> -----Original Message-----
> From: news [mailto:news@sea.gmane.org]On Behalf Of Davide Gurgone
> Sent: Friday, September 10, 2004 8:04 AM
> To: user@struts.apache.org
> Subject: ActionForm in session scope - the best way.
> 
> 
> Hi all,
> I did a cooding error, developing an actionForm in session and now I 
> have to recover this error, by taking another approach:
> 
> I used the actionForm validate and reset methods to perform 
> some things 
> that probably they had to be placed into the Actions.
> 
> Specifically i code a method that in a first time calculates only the 
> form's default values, but in a second time it becomes a method that 
> takes values from database, to fill the form!
> 
> I do this things 'cause I need to manage the insert and the 
> edit status 
> of the same things and I don't whant to code the same thing more than 
> one times.
> 
> Trying to follow the single-one cooding approach, I made the over 
> described error. And now I don't know how to move the code 
> away from the 
> form.
> 
> Were do you place the methods that have to initialize action forms?

In the actions.  I typically use ShowBlahFormAction as a name, and similar for the acutal
url.

> In some case I have to do this before populate, and in other 
> case after 
> the populate (reset and validate).

Not sure what you mean here.

> 
> what's the best way to validate | initialize the same form, 
> depending on 
> parameters?

Use the validate option in the action mapping. Turn it to false when setting up the form,
and true when the form gets submitted for edit or add.

> 
> I'm sorry for my bad english... I hope you understand me...
> 
> best regards,
> 
> --
> Davide Gurgone.
> davide_at_gurgone_dot_it
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

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


Mime
View raw message