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 Wed, 05 May 2010 12:24:41 GMT
On 5/5/10 2:57 AM, RogerV wrote:
> The final clue! I changed my jsp to;
> <s:checkboxlist name="selectedroles" list="%{availableroles}"
> value="%{preselectedroles}"/>

> checkbox?selectedroles=ROLE_ADMIN&selectedroles=ROLE_USER&selectedroles=ROLE_UBER&__multiselect_selectedroles=
> is sent. I saw an exception being thrown "No such method for
> setSelectedRoles(String) and the message

Very confusing that everyplace I've seen you have a lower case "r" in 
selectedroles, but here it's looking for capital "r"...

> So I changed the method setSelectedRoles(Map<String,String>  selectedRoles)
> to setSelectedRoles(String selectedRoles) and stuck the debugger on it, and
> what comes back is, as you suspected all along, a string value that contains
> a comma separated list of the selected values ie
> ROLE_ADMIN,ROLE_USER,ROLE_UBER which I can easily split&  shove back into
> the map of selected Roles.

The framework can be a bit more helpful than that -- if you make that 
take an array of Strings it should pre-split them up for you.  I'd go 
through and make sure you've got your capitalization consistent 
everywhere, too.

> Phew! I would never have worked that one out without your help and I
> certainly wouldn't have worked it out from the available documentation.

Sorry you had such difficulty.  If you have any specific suggestions for 
the documentation, please help us improve it so that it can better help 
the next person...

> Either checkboxlist will not return a map under any circumstances, in which
> case the documentation should say so, or there is a way of forcing the name
> attribute to evaluate to something that Struts would interpret as a map
> entry that I haven't worked out yet.

The tags are really only a server output thing -- is there someplace it 
appears to say how the results will come back?  Documentation for that 
should be wherever the params interceptor is documented.  Having that 
generate a map would require pairs of linked data coming in with the 
request, and I can't think of how that'd happen with standard html tags...


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

View raw message