Saturday, April 30, 2011

How to use two peroperty files in Seam and read values

Assume we have two properties files namely  messages.properties and application.properties In components.xml we place the below line

  <core:resource-loader bundle-names=”messages application”/>

Then in the Seam component where we want to retrieve the value for a given property (key), we inject the ResourceBundle as below.

  @In
    java.util.ResourceBundle resourceBundle;

 The retrieval is done as below

String imagesLocation = resourceBundle.getString(“IMAGESLOCATION”);