0 Replies Latest reply on Jun 23, 2006 10:22 PM by holgerprause

    Inject ResourceBundle to Bean

    holgerprause Newbie

      Hello,

      i used the Reverse Engeneering plugin to generate database code and jsp pages.

      JSP Pages
      -------------
      i added a file called "messages.properties" to the WEB-INF/classes folder
      In the jsp pages i can acces the ResourceBundle and a message will be displayed for the el- expression "msg.Member_country"


      <f:loadBundle basename="messages" var="msg" />
      <h:outputLabel value="#{msg.Member_country}" for="country">
       <h:inputText value="#{memberEditor.instance.country}" id="country" />
       <span class="rvgMessage"><h:message for="country" /></span>
      </h:outputLabel>
      





      JAVA-SIDE
      ------------
      In my generated Classes i have the following statement:
      @In
      private transient ResourceBundle resourceBundle;
      


      Well i think what the code above should do:
      Use the ResourceBundle loaded by the jsp page.
      I can load the Resourcebundle "manually" again in the bean,
      but as far i understood seam , this i what seam can do for me becourse it has already bean loaded and it can be injected.

      Did i understood this right? Pls correct me when i am wrong.

      If i leave this code unchanged i get an exception from seam

      Caused by: org.jboss.seam.RequiredException: In attribute requires value for component: memberEditor.resourceBundle


      well as workaround i changed the code to :
      @In(create = true)
      


      but that not really what i need, i need the same resourcebundle as used from jsp.

      Do u see any possebility how to do this ?(If not ill load it "old fashioned way")

      Thank u very much,

      Holger