You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Emil.I" <ia...@primus.ca> on 2008/03/19 23:10:09 UTC

ModelDriven action with action property

Hello
i have a textfield with the name="firstName"
and a textfield with the name="address.city" etc..
the action is model driven where firstName is the property of model.
Since address is a property of action (not property of model)

how come address.city does not get set it doesn't eve go to the setter???
p.s model properties get set eg. firstName.value etc..

Truly yours
-- 
View this message in context: http://www.nabble.com/ModelDriven-action-with-action-property-tp16152656p16152656.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: ModelDriven action with action property

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Emil.I wrote:
> Hello
> i have a textfield with the name="firstName"
> and a textfield with the name="address.city" etc..
> the action is model driven where firstName is the property of model.
> Since address is a property of action (not property of model)
>
> how come address.city does not get set it doesn't eve go to the setter???
> p.s model properties get set eg. firstName.value etc..
>   

Is it possible that you don't have a getter for address?
OGNL will first check your model for an address property, shouldn't find 
it, then checks your action for an address property (and deeper in the 
stack).
If you don't have a getter (getAddress()) it can't call the setter 
(getAddress().setCity(String)).  Also ensure it can instantiate an 
address and set it (or that your action has created it)

Other than that I don't see why you can't do what you're attempting.

Hope that helps,
Jeromy Evans

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