1 Reply Latest reply on Feb 14, 2007 10:37 AM by Anthony Whitford

    Correct Syntax for enum lookup in messages

    Anthony Whitford Newbie

      For an edit page, I have an enum. My code looks something like:

      <s:selectItems value="#{myEnumTypes}"
       var="enumType" label="#{messages[enumType]}"
       hideNoSelectionLabel="true" noSelectionLabel="Please select..."/>

      My problem is that I am not seeing any label text... I may have a bug in my build process, but I figured that it is worth asking...

      Consider a ficticious enum declaration:
      package com.mycompany.foo;
      public enum enumType
       public String toString ()
       return name().substring(2);

      Note that I am overriding toString because this enum is saved as a string to the database, and the "E_" prefix is redundant.

      For messages_en.properties, what should the entries be?

      Ironically, I have tried several permutations, and nothing seems to work, hence I am considering that I may have a build problem. But it would help to have a case like this documented since most of the examples are simply constants, like "#{messages.someMessageText}".