> -----Original Message-----
> From: Woodchuck [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 12, 2004 7:24 AM
> To: struts
> Subject: lifetime of ActionForm objects
> 
> 
> the following is my understanding, can someone please verify that i
> have it correct?
> 
>   - when a form is first submitted, Struts will create an instance of
> the ActionForm and then attempt to populate the submitted field data
> via the JavaBean convention into the ActionForm object
> 
>   - this ActionForm object 'lives' in the session context
> 
>   - the next time the same form is submitted, Struts does not create a
> new instance, but uses the one it created before

Actually, any form using that name... you can have several actions all using the same 
form name.

> 
> the reason i'm asking is because i have a situation where it 
> seems like
> the html form is linked directly to an object that i keep in 
> session...
> i don't know how this is happening, but when i submit my form, the
> object 'automatically' gets updated with the submitted form data...
> however, this object is not even an ActionForm object... it's 
> an object
> that i manually copy ActionForm data to, but somehow it seems to have
> been 'linked' to the html form and the next time the data fields are
> updated before i even copy them there

How are you doing the copy?  I'm betting that the copy is binding the objects together 
in some way.  If all your doing is objectA=objectB (stringA = stringB) you aren't 
really copying in java, your sharing a reference to the same object.  If stringB is in 
the form, then every time stringB changes, everything referencing stringB will change, 
including stringA


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

Reply via email to