[ 
https://issues.apache.org/struts/browse/WW-2763?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Musachy Barroso resolved WW-2763.
---------------------------------

    Resolution: Not A Problem

By setting listKey,  struts will compare the value of the keys (in this case 
string), with the list of selected objects, in this case enums, which will 
never match, hence none will be selected.

> 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
>             Fix For: 2.1.3
>
>
> 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