You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "James Holmes (JIRA)" <ji...@apache.org> on 2008/12/16 04:47:36 UTC

[jira] Updated: (WW-2763) Prepopulation of checkboxlist fails when using listValue and listKey in FreeMarker tag

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

James Holmes updated WW-2763:
-----------------------------

    Fix Version/s: 2.1.3

> 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="%{@domainobjects.util.TrainingAttribute@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="%{@domainobjects.util.TrainingAttribute@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.