I have come up with a solution so elegant it brings tears to my eyes:)  

Color is an enum. I convert it to a map that can be useBean'd and dereferenced 
in EL. So my app uses the enum while the JSP uses the same enum in map form. 
Sweet!  

public class ColorMap<String, String> extends TreeMap  {
        public ColorMap() {
                for(Color value : Color.values()) {
                        put(value.name(), value.name());
                }
        }
}

Usage: note that  EL does map lookups using dot notation making for some very 
clean syntax:

<useBean id="colors" class="ColorMap"...

...



<input type="submit" value="${colors.Seafoam}" ...




View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3872937#3872937

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3872937


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to