struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joachim Ansorg <jans...@ksi.gr>
Subject Re: Spring autowiring null values
Date Mon, 19 May 2008 13:45:07 GMT
AFAIK Struts2 tries to set a new value to an object if it's currently null.

E.g. a new value for "person.address.street" should be set in a request. 
If "person" is created in the prepare() method and if the action uses an 
paramsPrepareParams stack then Struts2 tries to create the person object 
in the first params run. Which doesn't make much sense in this case 
because person will be created later by the action.

In the project I'm working on we don't have a setPerson method in the 
action so a new value can't be set from the outside.
And we're using an interface for Person so S2 doesn't know what to create.

Havn't found a way to turn the behaviour off, though.

Regards,
Joachim
> We would like to turn off the autowiring completly.
> I understand that this is not really anything to do with STRUTS2, but 
> since it seems to be set via the STRUTS Spring plugin
> I thought you guys would know.
>
> Regards
> Ian
>
>
> CSC Solutions Norge AS
> Registered Office: SandsliƄsen 57, 5254 Sandsli, Norway 
> Registered in Norway No: 958 958 455
>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> This is a PRIVATE message. If you are not the intended recipient, please 
> delete without copying and kindly advise us by e-mail of the mistake in 
> delivery. 
> NOTE: Regardless of content, this e-mail shall not operate to bind CSC to 
> any order or other contract unless pursuant to explicit written agreement 
> or government initiative expressly permitting the use of e-mail for such 
> purpose.
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>
>
>
> Dave Newton <newton.dave@yahoo.com> 
> 19.05.2008 15:28
> Please respond to
> "Struts Users Mailing List" <user@struts.apache.org>
>
>
> To
> Struts Users Mailing List <user@struts.apache.org>
> cc
>
> Subject
> Re: Spring autowiring null values
>
>
>
>
>
>
> Spring autowiring (is autowiring by name the default?) isn't related to
> XWork at all AFAIK.
>
> Can you be a bit more specific about what behavior you're seeing
> contrasted against what you'd prefer?
>
> I mean, you can set Spring's default wiring to something else or turn
> it off altogether.
>
> Dave
>
> --- Ian Meikle <imeikle@csc.com> wrote:
>   
>> Is there a way of stopping Spring from autowiring values ?
>> Especially null values?
>>
>> We use Spring to set up our actions to ease the integration of
>> hibernate, but we do not want Spring to set default values when 
>> property is null.
>>
>> Can this be turned off ?
>>
>> I have tried <constant name="xwork.NullHandler.createNullObjects"
>> value="false"/> but this does not seem to be respected in all cases. 
>>     
>
>
> ---------------------------------------------------------------------
> 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