tr:selectOneRadio - no preselection (default value) with java 5 enums
---------------------------------------------------------------------
Key: TRINIDAD-830
URL: https://issues.apache.org/jira/browse/TRINIDAD-830
Project: MyFaces Trinidad
Issue Type: Bug
Components: Components
Reporter: Gerhard Petracek
Priority: Minor
sample scenario:
public class Person
{
...
private Character gender; //I chose Character to compare possibilities
//+ getter and setter methods
}
-> within tr:selectOneRadio the following two selectItems work very well:
<tr:selectItem label="#{messages.female}" value="f" .../>
<tr:selectItem label="#{messages.male}" value="m" .../>
("f" and "m" is important for the comparison)
the example above also works with a java 5 enum with one exception -
preselected values:
e.g.:
public enum Gender
{
female, male
}
->
public class Person
{
...
private Gender gender;
//+ getter and setter methods
}
in comparison to the first example it would be logical to use the following
possibility (with the enum version of this example):
<tr:selectItem label="#{messages.female}" value="female" .../>
<tr:selectItem label="#{messages.male}" value="male" .../>
this version of the example works well with the exception of the
preselected/default value
(e.g. if the page is redisplayed and should provide the previous entered
value(s) or a simple default selection which is not reasonable for this gender
example...)
---
at the moment the following workaround is possible:
<tr:selectItem label="#{messages.female}" value="#{pageBean.female}" ..."/>
<tr:selectItem label="#{messages.male}" value="#{pageBean.male}" ..."/>
within pageBean:
public Gender getFemale()
{
return Gender.female;
}
public Gender getMale()
{
return Gender.male;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.