struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Newfield <>
Subject Re: Where is the documentation for Struts tags ....
Date Tue, 04 May 2010 14:51:32 GMT
On 5/4/10 10:08 AM, RogerV wrote:
>>> <s:checkboxlist name="selectedroles" list="%{availableroles}"
>>> value="%{preselectedroles}"/>

> <input type="checkbox" name="{}" value="ROLE_ADMIN" id="{}-1"/>
> <input type="checkbox" name="{}" value="ROLE_USER" id="{}-2"
> checked="checked"/>
> <input type="checkbox" name="{}" value="ROLE_UBER" id="{}-3"/>

> The rendering is a bit odd, which makes me feel I'm still missing
> something.

Due to the fact that there are three checkboxes with the right values 
and the right pre-selection, we know that the list attribute and the 
value attribute of the tag are working as desired.  The name clearly 
isn't working.  I've never used a checkboxlist, and I'm unclear as to 
how the values are aggregated on submission into the map you desire, but 
this brief documentation seems to jive with my understanding that "name" 
is usually just that--the name the input tag will use to submit the 
field to the server:
"name	false		false	String	The name to set for element"

So if it's looking for a string, let's make sure you're giving it one, 
and not the .toString of an empty map that it got from your prepare method:

<s:checkboxlist name="%{'selectedroles'}" list="%{availableroles}" 

I must admit I don't understand what you expect this to submit, or how 
that should become a map -- there are only one set of values, not 
pairs...Even if you get this to render the html I'm guessing that you 

<input type="checkbox" name="selectedroles" value="ROLE_ADMIN" 
<input type="checkbox" name="selectedroles" value="ROLE_USER" 
id="selectedroles-2" checked="checked"/>
<input type="checkbox" name="selectedroles" value="ROLE_UBER" 

I don't see how you'd get a map out of that.  You could get a String[] 
easily, which would be the ROLE_ values that were checked...


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message