[jboss-user] [JBoss Seam] - Correct Syntax for enum lookup in messages

awhitford do-not-reply at jboss.com
Wed Feb 14 00:09:35 EST 2007

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
  | {
  |     E_ABC,
  |     E_PQR,
  |     E_XYZ;
  |     @Override
  |     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}".


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

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

More information about the jboss-user mailing list