struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wild_oscar <mig...@almeida.at>
Subject Re: Can s:select multiple have a object.someList as name?
Date Fri, 12 Feb 2010 16:39:39 GMT



wild_oscar wrote:
> 
> 
> I am trying to pass the multple selected items on a s:select onto a
> List<Serious> that I have on an "some" object:
> 
> Some{
> List<Serious> seriousness; ...}
> 
> I am using spring to inject "some" in my action:
> <bean id="some" scope="prototype"
> 		class="package.SomeClass">
> 	</bean>
> 
> Using a:
> <s:select multiple="true" value="%{#some.seriousness.{id}}" 
> multiple="true" name="some.seriousness.id"  list="activeIngredients"
> listKey="id" listValue="name" />
> 
> I'm facing an issue: the some.seriousness is being injected with multiple
> Serious objects, with some repetitions of selected elements.  If I select
> 2 elements, I'll get a list with size 4 (2x each one), sometimes more.
> 
> I've also tried with name="some.seriousness", but this one goes directly
> to input result (indicating an error in populating the fields).
> 
> Note that if name="seriousList" and I can successfully see selected items
> if I declare an Integer[] in the action:
> 
> Integer[] seriousList; 
> 
> Does anyone know how to successfully inject the selected values onto the
> object's list.
> 
> 
> 


A few months later, I still haven't found a way to do this. 

Is there a way to have the selected fields in a multiple select be injected
onto an object's list property? 

In other words, in the example:

<s:select label="Pets"
       name="petIds"
       list="petDao.pets"
       listKey="id"
       listValue="name"
       multiple="true"
       size="3"
       required="true"
       value="%{petDao.pets.{id}}"
/>

the action will need an Integer[] petIds.

Is there a way for the action to have an "owner" object  (there's a property
called owner.pets), where the selected fields populate owner.pets ?
-- 
View this message in context: http://old.nabble.com/Can-s%3Aselect-multiple-have-a-object.someList-as-name--tp26324775p27566176.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


Mime
View raw message