[
https://issues.apache.org/struts/browse/WW-2238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44187#action_44187
]
Robert-Jan Westerhof commented on WW-2238:
------------------------------------------
Actually, when treated the same as listKey and listValue (i.e. retrieving the
label via stack.findValue(parameters.label)), the label is no more constant
than the listKey and listValue are. Personally, I use a list of objects that
have 3 attributes, a key, a value and a label, thereby allowing the set of
labels to be different from the set of values (if you so choose). It does make
sense to default back to the listValue though, iso "top".
> checkboxlist labels and values mixed up
> ---------------------------------------
>
> Key: WW-2238
> URL: https://issues.apache.org/struts/browse/WW-2238
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Tags
> Affects Versions: 2.0.9
> Reporter: Robert-Jan Westerhof
> Priority: Minor
> Fix For: 2.1.3
>
>
> The checkboxlist.ftl that ships with struts2 2.0.9 uses the listValue
> attribute to populate the labels. The listKey is used as the checkbox values.
> The label attribute is not used at all in the template.
> The template as shipped in the template/simple directory in the
> struts2-core-2.0.9.jar contains the following:
> ...
> <#if parameters.listKey?exists>
> <#assign itemKey = stack.findValue(parameters.listKey)/>
> <#else>
> <#assign itemKey = stack.findValue('top')/>
> </#if>
> <#if parameters.listValue?exists>
> <#assign itemValue = stack.findString(parameters.listValue)/>
> <#else>
> <#assign itemValue = stack.findString('top')/>
> </#if>
> <#assign itemKeyStr=itemKey.toString() />
> <input type="checkbox" name="${parameters.name?html}"
> value="${itemKeyStr?html}" id="${parameters.name?html}-${itemCount}"<#rt/>
> ...
> />
> <label for="${parameters.name?html}-${itemCount}"
> class="checkboxLabel">${itemValue?html}</label>
> ...
> I believe this should read something like
> ...
> <#if parameters.listKey?exists>
> <#assign itemKey = stack.findValue(parameters.listKey)/>
> <#else>
> <#assign itemKey = stack.findValue('top')/>
> </#if>
> <#if parameters.listValue?exists>
> <#assign itemValue = stack.findString(parameters.listValue)/>
> <#else>
> <#assign itemValue = stack.findString('top')/>
> </#if>
> <#if parameters.label?exists>
> <#assign itemLabel = stack.findString(parameters.label)/>
> <#else>
> <#assign itemLabel = stack.findString('top')/>
> </#if>
> <input type="checkbox" name="${parameters.name?html}"
> value="${itemValue?html}" id="${parameters.name?html}-${itemCount}"<#rt/>
> ...
> />
> <label for="${parameters.name?html}-${itemCount}"
> class="checkboxLabel">${itemLabel?html}</label>
> ...
> Bug priority set to minor, as there is an easy workaround by defining a
> custom template...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.