now i want to display its description in jsp if values coming from database is 1.
So my question is how to display Enum in jsp file using JSF ??? [ August 23, 2007: Message edited by: Nirav Sanghavi ]
Basker Ganesan
Greenhorn
Joined: Feb 28, 2003
Posts: 2
posted
0
Have a geter method to return the Enum value as String in your bean and display that in your jsp.
Ex- /** * @return the status */ public ConfigStatusEnum getStatus() { return status; }
// Use this method in your jsp
/** * @return the status */ public String getStatusAsString() { return status.getValue(); }
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
JSF 1.2 supports enums. It has a built in EnumConverter.
If you're using JSF 1.1 or older, you'll have to write your own EnumConverter based on javax.faces.converter.Converter. It's fairly straighforward: in the getAsString() you returns enum's name() and in getAsObject() you use enum's valueOf().