Greg Huber created WW-3912:
------------------------------

             Summary: CheckboxList does not render correctly
                 Key: WW-3912
                 URL: https://issues.apache.org/jira/browse/WW-3912
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - Java Templates
    Affects Versions: 2.3.4.1
         Environment: Centos/tomcat
            Reporter: Greg Huber
            Priority: Minor


Hello,

The CheckboxList does not handle correctly the params.get("nameValue");, as for 
the list they are an array of strings.

The following code makes it work correctly, CheckboxListHandler.java

Boolean checked = false;
if (itemKeyStr != null) {
 String[] parms = (String[]) params.get("nameValue");
 for (String parm : parms) {
  if (checked = parm.equalsIgnoreCase(itemKeyStr))
   break;
 }
}
                
//Checkbox button section
Attributes a = new Attributes();
 a.add("type", "checkbox")
 .add("name", name)
 .add("value", itemKeyStr)
 .addIfTrue("checked", checked)  <<< CHANGED
 .addIfTrue("readonly", params.get("readonly"))
 .addIfTrue("disabled", disabled)
 .addIfExists("tabindex", params.get("tabindex"))
 .addIfExists("id", name + "-" + Integer.toString(cnt++));


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to