struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Husted" <hus...@apache.org>
Subject Re: ModelDriven & Action
Date Wed, 21 Mar 2007 19:07:46 GMT
The point of ModelDriven is that we don't have to refer to the
"parent" or "model" property. We can just refer to the property
flat-out, as if it were a property of the Action class.

In this case, it might be that the reference should be to
child.property, rather than parent.child.property, since the parent is
made implicit by virtue of ModelDriven.

Depending on the situation, another way to go might to create a custom
version of the ModelDriven interceptor that puts several domain
objects on the value stack, so that the references do not need to be
nested. The stack can contain any number of JavaBeans. The last bean
pushed with the property sought wins.

-HTH, Ted
<http://www.husted.com/ted/blog/>


On 3/21/07, stanlick@gmail.com <stanlick@gmail.com> wrote:
> I have an interesting situation which I am going to simplify in an attempt
> to establish dialog.  I have a web page that contains a form with ten
> properties on it.  The Action that is associated with this form contains a
> Domain object that I wish to populate from this form.
>
>
>    - Seven of the web properties have associated properties in that
>    Domain object
>    - One web property is making a "Prototype" AJAX call to a server
>    resource
>    - Two are read only and being populated with the AJAX payload
>
> The Domain Object contains a nested Domain object that I'm trying to
> populate using these three fields.  Does S2 limit the depth to which Action
> Domain objects can be populated?  After much reading, it appears that so
> long as there are appropriate get/set methods, the Domain object graph
> should be populated from my form -- but it's not!  My submit populates the
> seven "top level" properties, but fails to populate nested object
> properties.  I have double checked the names of my web page fields to make
> sure they reference the appropriate "get/set path" and all looks
> well-aligned with the two domain objects.
>
> s:textfield name="parent.child.property...
>
> Lastly, what are the rules with implementing ModelDriven on an action?  Does
> this getModel() provide a benefit over what seems to happen without it?
>
> I'll stop for now.
>
> --
> Scott
> stanlick@gmail.com
>

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


Mime
View raw message