3

I have Java enum type and I would like to get from myEnum.name() the associated i18n value.

I tested that :

<h:outputLabel value="#{rb.#{login.myEnum}}" />

(rb is my i18n variable defined in JSF faces-config.xml)

but it doesn't work.

I want EL expression that will be converted into #{rb.KEY1} and after key1 or clé1 or schlüssel1 etc if the locale selected is English, French or German.

How can I do it?

BalusC
  • 1,040,783
  • 362
  • 3,548
  • 3,513
Olivier J.
  • 3,045
  • 11
  • 46
  • 70

1 Answers1

7

There is no need to try to use #{} inside #{} (and anyway its illegal...)

You should access it with the help of [] (like accessing a map)

Try it like this

<h:outputLabel value="#{rb[login.myEnum]}" />
Daniel
  • 36,273
  • 9
  • 115
  • 187