I would have a setter on my action class that takes an array of ids.  Then the 
action does the appropriate lookups, and sets the hydrated objects on the 
appropriate models.
You do recognize that the data you provided is ambiguous, though, right?  
Nothing you stated is sufficient to know *which* entity2 objects should be set 
on entity, just which entity3 objects you want those entity2 objects to have.  
In fact, if you don't happen to get a number of entity3 ids that matches the 
number of entity2s on entity, you've left yourself no way of knowing how to 
proceed. (Remember, all you get is a (potentially unordered) list of ids from 
the form submission, not tuples.)

-Dale

On May 29, 2013, at 6:27 AM, Miguel Almeida <mig...@almeida.at> wrote:

> Dear all,
> 
> Imagine you have the following scenario:
> - a property in your action: private Entity entity;
> 
> - Entity has a List<Entity2> entity2List
> - Entity2 has a Entity3 entity3
> 
> Now, you need an s:select with multiple="true" to populate entity3. This
> corresponds to having a request in the form
> entity.entity2List[n].entity3.id (n=0,1,2...depending on how many items
> are selected).
> 
> Question: how should the name parameter of the s:select be like to
> achieve this?
> 
> Me and Lukasz  have tried the following without success (meaning
> entity.entity2List has is empty):
> <s:select key="centre.choose" multiple="true"
> name="%{entity.entity2List[].entity3.id}" list="#someList" listKey="id"
> listValue="code"/>
> <s:select key="centre.choose" multiple="true"
> name="entity.entity2List[].entity3.id" list="#someList" listKey="id"
> listValue="code"/>
> 
> 
> Thank you for your help!
> 
> Miguel Almeida
> 

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

Reply via email to