You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Moacir Cardoso <mo...@yahoo.com.br> on 2007/09/02 04:23:21 UTC

Checkboxlist - bind to List
Hello!,
I´m trying to bind some checkbox values to one parameterized List. Lets 
say List<Car>.
Is it possible?

in Jsp:
<s:checkboxlist name="myList.carId" 
list="#{'1':'Car1','2':'Car2','3':'Car3'}"></s:checkboxlist>

in Action:

private List<Car> myList;
.. gets and sets.

Moa ;-)

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


Re: Checkboxlist - bind to List Posted by Laurie Harper <la...@holoweb.net>.
Moacir Cardoso wrote:
> Hello!,
> I´m trying to bind some checkbox values to one parameterized List. Lets 
> say List<Car>.
> Is it possible?
> 
> in Jsp:
> <s:checkboxlist name="myList.carId" 
> list="#{'1':'Car1','2':'Car2','3':'Car3'}"></s:checkboxlist>
> 
> in Action:
> 
> private List<Car> myList;
> ... gets and sets.

If you already have a list in your action, you don't need/want to 
hardcode one in the tag. Try something like:

   <s:checkboxlist name='myListSelected' list='myList'
     listKey='carId' listValue='carName'/>

See the tag docs for more options:

   http://struts.apache.org/2.x/docs/checkboxlist.html

L.


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