Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [JBoss Seam] - Re: howto display the an enum object
 internationalized

scott.stark@jboss.org

2007-06-11


This is an example of an approach I have used for drop-down lists. Each constant is instantiated with the key defined in the messages properties file:


| public enum Salutation {
|  
|  MR("salutation-mr-label"),
|  MRS("salutation-mrs-label"),
|  MS("salutation-ms-label");
|  
|  private String labelKey;
|  
|  Salutation(String labelKey) {
|    this.labelKey = labelKey;
|  }
|
|  public String getLabelKey() {
|    return labelKey;
|  }
| }
|

Need to create a factory to return array of enum values to view


| @Name("factories")
| public class Factories {
|  
|  @org.jboss.seam.annotations.Factory("salutationTypes")
|  public Salutation[] getSalutationTypes() {
|    return Salutation.values();
|  }
| }
|



| <f:selectOneMenu id="salutations" value="#{backingBean.salutation}">
|  <s:selectItems value="#{salutationTypes}" var="salutation" label="#{messages[salutation.labelKey]}"/>
|  <s:convertEnum />
| </f:selectOneMenu>
|

I appreciate this doesn't answer your query directly but it may give you a few clues.



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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053282
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.