Prepopulation of checkboxlist fails when using listValue and listKey in 
FreeMarker tag
--------------------------------------------------------------------------------------

                 Key: WW-2763
                 URL: https://issues.apache.org/struts/browse/WW-2763
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.0.11.2
         Environment: Struts 2.0.11.2, Vista, Java 1.6.007, FreeMarker
            Reporter: Stephan Schroeder
            Priority: Minor


This usage of the checkboxlistworks
<@s.checkboxlist label="Attribute" name="trainingAttributes"  list="[EMAIL 
PROTECTED]@values()}"/>

domainobjects.util.TrainingAttribute is an enum.
trainingAttributes is an array of type TrainingAttribute with a subset of 
TrainingAttribute.values().
Of course this displays the Java-Names of the enum-Instances therefore i added 
the two methods for the key and the name:

public enum TrainingAttribute
{
  ADVANCED,BEGINNER,CHILDREN,WEAPON;
  
  public String getKey()
  {
    return toString();
  }
  
  public String getName()
  {
    switch( this ) {
      case ADVANCED: return "Fortgeschrittene";
      case BEGINNER: return "Anfänger";
      case CHILDREN: return "Kinder";
      case WEAPON:   return "Waffen";
    }
    throw new RuntimeException( "unknown enum:"+getClass().getName() );
  }
}

Now i added the listValue- and listKey-parameter:
<@s.checkboxlist label="Attribute" name="trainingAttributes"  list="[EMAIL 
PROTECTED]@values()}" listValue="name" listKey="key"/>

but no checkbox is checked. Using @s.select with the multiple=true option 
doesn't prepopulate either.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to