i have a checkboxlist which entries are derived from possible values of an
enum (named TrainingAttribute).
This usage of the checkboxlist works
<@s.checkboxlist label="Attribute" name="trainingAttributes"
list="@domainobjects.util.trainingattrib...@values()}"/>
"trainingAttributes" gives 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.
So what's the right way to write and use a localised enum set in a
checkboxlist?
/Stephan
--
View this message in context:
http://www.nabble.com/How-to-use-a-localised-enum-in-a-checkboxlist-tp21280363p21280363.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]