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,082,665
  • 372
  • 3,610
  • 3,555
Olivier J.
  • 3,115
  • 11
  • 48
  • 71

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,833
  • 10
  • 119
  • 200