[S2] Does struts set null values for pojo fields?

2008-08-20 Thread Gawain Hammond
Hi, I have tried to RTFM as much as possible but I can't work out how I might solve this issue, and was hoping someone could point me in the right direction. I've tried quite a few possible different options but I'm now running out of ideas. I'm using a select tag in a User form to set the User's

Re: [S2] Does struts set null values for pojo fields?

2008-08-21 Thread Stephan Schröder
I think you cann't expect Struts 2 to automatically remove an object just because one of it's properties is set to null. Ok, in your case it's the id-property but struts 2 (or better OGNL) doesn't know that. So i don't think this is worth a feature request. But here is the workaround i'd use: use

RE: [S2] Does struts set null values for pojo fields?

2008-08-21 Thread Gawain Hammond
ept that I was hoping struts2 could automatically remove an object if *all* of it's properties were null, not just one. Would your answer be the same given this minor difference? -Original Message- From: "Stephan Schröder" [mailto:[EMAIL PROTECTED] Sent: 21 August 2008 09:10

RE: [S2] Does struts set null values for pojo fields?

2008-08-21 Thread Andy Law
Gawain Hammond wrote: > > Thanks very much for your reply. > > The problem with this type of work around is that it completely messes up > my fiendish master plan. If it wasn't for those pesky objects with null > values! :-P > > You see, I've probably been a bit too clever for my own good, an

Re: [S2] Does struts set null values for pojo fields?

2008-08-21 Thread Dustin Pearce
What you are saying when you post user.group.id = '' is to set the group object of the user id property to null. What you want to say is set user.group to null. To do that create a TypeConverter for Group rather than try to maintain the id directly. This way when the id (String representa

Re: RE: [S2] Does struts set null values for pojo fields?

2008-08-21 Thread Stephan Schröder
loper Guide: http://www.opensymphony.com/ognl/html/DeveloperGuide/index.html /Stephan Original-Nachricht > Datum: Thu, 21 Aug 2008 11:36:47 +0100 > Von: "Gawain Hammond" <[EMAIL PROTECTED]> > An: "Struts Users Mailing List" > Betreff: RE: [S2] Does

Re: RE: [S2] Does struts set null values for pojo fields?

2008-08-21 Thread Stephan Schröder
> Can you define an interface that is common across all the actions/model > objects. Then you can have the relevant Actions implement the interface > and > write an interceptor to check the value of the specified fields and set > them > to null if required after checking that the object is of the