Problem: Unable to use more than 2 <bean:message> tags in jsp's.
I am using struts 1.1 version. I deployed a ear file( in weblogic8.1) which contains a war file in it. And this war contains multiple strus-config.xmls.
They are well defined in web.xml
Each struts-config.xml contain its own respected applicationResource.properties like login_struts-config.xml contain loginApplicationResources.properties.....
Using <bean:message> tag I want to achieve i18N-internalization.
It is working fine for my login module(login_struts-config.xml,loginApplicationResource.properties). It successfully accepting more than 2 <bean:message> tags in my login.jsp, but when i am logged in and accessing other jsp's of other modules, only first <bean:messge key="abc" > is taking and for another <bean:message key="xyz" > tag it giving and exception in console saying the key 'xyz' is not found in application resources.
Every module has its own application resources and placed at WEB-INF/classes folder.
But when i used the key names from loginApplicationResources.properties in jsp's of other module's, it accepting more than 2 <bean:messages >, but it is not taking from other resources properties of respected modules.
I think each time its loading loginApplicatioResource.properties only.
I tried with struts 1.2.0, 1.3.10 jars also, and problem is not solved.
I'd assume that the root-level config param is application-wide. The other config params are per-module.
Application-wide resources would be available across the entire application, which is why you can use those resources in other modules. Module-specific resources, however, would be available only in that specific module.
The problem description, "Problem: Unable to use more than 2 <bean:message> tags in jsp's" isn't really accurate or descriptive--you can use as many bean:message tags as you want. The *real* problem is that you're unable to access module-specific resources from other modules, correct?
Perhaps re-phrasing the problem description would help someone more familiar with modules; I never used them as they seemed far more trouble than they were worth.
Yes its available in Struts 1.1. Simple search "Multiple resources file in Struts " will lead you to tutorials..
You are welcome.
Joined: Mar 28, 2009
As per your suggestion, i implemented bundle attribute in my jsp's.
in login_struts-config.xml i written like this.
parameter="LoginApplicationResources" key="loginResource" id="message-resources_1"/>
in my login.jsp
<bean:message key="login.test.text" bundle="loginResource"/>
and its working fine.
in xyz_struts-config.xml i written like
parameter="XYZApplicationResources" key="XYZResource" id="XYZ_message-resources_1"/>
<bean:message key="xyz.loginId" bundle="XYZResource" />
But iam getting error like
javax.servlet.jsp.JspException: Cannot find message resources under key XYZResource
For login module it is working properly, but my xyz module its not working.
you can see these class:
the breakpoint can set in org.apache.struts.action.ActionServlet's method "init"
in ActionServlet's method "init()", the primary code is
"initModuleMessageResources(moduleConfig);" about on line 348;
you can step into this method what name is "initModuleMessageResources(ModuleConfig config)"
see this method's last code:
mrcs[i].getKey() + config.getPrefix(),
do you understand?
we can use in jsp like this:
hope can help you!
I'm chinese, my english is so bad. could you hep me?
my e-mail is :email@example.com
I'm a chinese, my english is so bad, I need help. If you want to help me, you can send your question to my e-mail: firstname.lastname@example.org, I will help you, and improve my english. Thanks everyone.
Joined: Mar 28, 2009
Thank you for splendid responses/solutions.
I solved this problem by deploying the same ear in weblogic9.1. I didn't modified any code, and its working fine in weblogic 9.1 and websphere 6.1.
I tried defining multiple resources in struts-config.xml but , only the last resource loading in weblogic 8.1.
Even without key attribute , its working fine in weblogic 9.1 and websphere 6.1.
I guess is there any bug in loading multiple resource bundles inweblogic 8.1?
But Thank you once agin to you All!!!
subject: unable to use more than 2 <bean:message. tags in jsp