Here's what I have done
In components.xml
<core:resource-loader> <core:bundle-names> <value>office_messages</value> </core:bundle-names> </core:resource-loader>
In my code
@Name("officeIdReader")
public class OfficeIdReader implements Serializable
{
@In
private Map<String, String> messages;
@In
private ResourceBundle resourceBundle;
private Collection <SelectItem> officeIds;
public OfficeIdReader()
{
officeIds = new ArrayList<SelectItem>();
initOfficeIds();
}
private void initOfficeIds()
{
for ( String key: messages.keySet())
{
if ( key.startsWith("officeId"))
{
officeIds.add( new SelectItem(messages.get(key)));
}
}
}
public Collection<SelectItem> getOfficeIds() {
return officeIds;
}
public void setOfficeIds(Collection<SelectItem> officeIds) {
this.officeIds = officeIds;
}
}
Both messages and resourceBundle are null.. any ideas?
The messages.properties file is the default set, so you must add them also to the resource-loader. Just ad another value with messages, and that should do the trick.
Leo