13 November 2008

How to read values from properties file in JBoss Seam

Let us 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 exhibitSaveLoc = resourceBundle.getString("exhibitsavelocation");