0

I write an application based on JSF, EJB and JPA.

For localization I defined a messages.properties and a messages_en.properties.

Thus, I can use the translations in my .xhtml and ManagedBeans. My business-logic lies in the EJBs. Is it possible to access the Strings in my EJB Classes?

matthias
  • 1,938
  • 23
  • 51
  • 1
    It is difficult to answer if you do not post your project structure. That said, if the files are related to the presentation layer (web), they should not be accessed by the business layer (as you should be able to change the presentation layer for a different one -v.g. WS- without having to alter the business layer at all). – SJuan76 Oct 27 '15 at 13:18
  • 2
    At the lowest level JSF too just works on top of the standard Java internationalization logic. There is nothing stopping you from accessing that data from any class you want. https://docs.oracle.com/javase/tutorial/i18n/ . That being said, needing it in an EJB might be a sign of a design flaw as internationalization is generally more of a presentation thing. It would make more sense if you would want to know how to get it from a backing bean. http://stackoverflow.com/questions/6272945/how-can-i-get-a-message-bundle-string-from-inside-a-managed-bean – Gimby Oct 27 '15 at 13:43

0 Answers0