Here's the code for the enum:
| public enum Enum_level
| {
| GOOD("Good"), AVERAGE("Average"), BAD("Baaad!") ;
|
| private String label;
|
| Enum_level (String label)
| {
| this.label = label;
| }
|
| public String getLabel()
| {
| return label;
| }
|
| public Enum_level[] getValues() {
|
| return Enum_level.values();
|
| }
|
| public String toString()
| {
| return label;
| }
| }
|
|
and here's the accompanying jsf code:
| <h:selectOneMenu id="level" value="#{ViewBlogComponent.reply_r.level}">
| <s:selectItems
value="#{ViewBlogComponent.reply_r.level.values}" var="enum"
label="#{enum.label}" noSelectionLabel="Please select : "/>
| <s:convertEnum/>
| </h:selectOneMenu>
|
However, it turns out that the problem of not being able to get enum values
from non-initialized references is still there. I think the EL-resolver just
refuses to call getValues(), when (in this case) getLevel() returns null.
Though it can safely do so, since it is a static accessor. Bummer :-( I really
hoped this would work... this should be possible, right??
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054970#4054970
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054970
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user