1 Reply Latest reply on Aug 17, 2007 9:58 AM by damianharvey

    localization messages access from Java code

    dnikolov

      Hi,

      I am trying to access a message defined in my messages_en.properties file from my backing Java code per the instructions in the Seam manual in the localization/internationalization section. I am doing something like this:

      @In("#{messages['l.someDbTable.usexCol']}") private String ORIENTATION_USEX;
      @In("#{messages['l.someDbTable.useyCol']}") private String ORIENTATION_USEY;

      private final SelectItem[] ORIENTATION_ITEMS = new SelectItem[] {
      new SelectItem(this.ORIENTATION_USEX),
      new SelectItem(this.ORIENTATION_USEY)
      };

      Doing this results in a NullPointerException at the SelectItem array declaration. I am assuming I need to specify what messages is somewhere in an xml config file.

      Note that I can refer to messages in my xhtml front end code as in: #{messages['l.someDbTable.useyCol']}

      In my faces_config.xml I have this :

      <message-bundle>messages/Models</message-bundle>
      <message-bundle>messages</message-bundle>
      <view-handler>com.icesoft.faces.facelets.D2DSeamFaceletViewHandler</view-handler>


      but I am not sure how relevant this is. Can you provide a solution or a more detailed source on using localization in Seam? Thanks!