Search This Blog

Loading...

Sunday, October 24, 2010

Multiple Resource bundle in struts.

I had got one requirement from client as I had to implement multiple resource bundles and define same key in both bundle.
 
Example –
 
Say I have ApplicationResources.properties which has all global level messages defined and another module specific property file. If because of some reason the key didn't find in module specific file then System should display message from my global (ApplicationResources.properties) file.
 
I struggled a lot to find solution for the same and finally I found one.
 
Keep both properties files in class path.
updated struts-config.xml file as below
 
<message-resources parameter="Account,ApplicationResources" null="false" />
 
Create CustomeActionServlet and  CustomMessageResources.javause <bean:message> tag in the jsp to display text
And the message will be render from all files. Download here..

1 comment: