Bizzare, I'm having the exact opposite problem (my problem is the
solution you want).

Similar setup, and when I view the object's data in a form then submit
it, struts uses the exact same object instance to then submit the form.
So if I try to clear any fields (effectively null them), for a cleared
field the object keeps the old values that were originally retrieved
from persistence.

Does struts create a new object for every submit? And under what
circumstance would it not?


Cheers,
Gawain

-----Original Message-----
From: Bobby Politte [mailto:[EMAIL PROTECTED] 
Sent: 29 September 2008 16:44
To: user@struts.apache.org
Subject: Struts 2 CRUD Question

Hi,

I'm just getting back into Struts after a few years away from web
programming.  I've got a question about methods for updating only
certain members of an object.

I've got a struts action that creates, updates and deletes a User
object. When updating though, I have two different jsp pages that
update only part of the object (user information on one, and password
on the other).  Unexpectedly (at least to me), Struts sets the members
of the User object not on the form to null.  I'd expected it to only
update the members specifically tied to controls on the form and
assume no change for any members of User *not* in the form.

Is there a way to only update those members of the object represented
on the form?  Do I *need* to use some DTO to do this?  Or split my
User object up into User and Password objects?

thanks,

Bobby

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
----------------------------------------------------------
This transmission is strictly confidential, possibly legally privileged, and 
intended solely for the 
addressee.  Any views or opinions expressed within it are those of the author 
and do not necessarily 
represent those of 192.com, i-CD Publishing (UK) Ltd or any of it's subsidiary 
companies.  If you 
are not the intended recipient then you must not disclose, copy or take any 
action in reliance of this 
transmission. If you have received this transmission in error, please notify 
the sender as soon as 
possible.  No employee or agent is authorised to conclude any binding agreement 
on behalf of 
i-CD Publishing (UK) Ltd with another party by email without express written 
confirmation by an 
authorised employee of the Company. http://www.192.com (Tel: 08000 192 192).  
i-CD Publishing (UK) Ltd 
is incorporated in England and Wales, company number 3148549, VAT No. GB 
673128728.

Reply via email to