| Author |
Message resources and struts modules
|
Jeremy Tukif
Greenhorn
Joined: Sep 28, 2005
Posts: 2
|
|
Hi all, I have an application with several modules. In one of these modules, I defined the two following message resources: <message-resources key="context" null="false" parameter="blabla.context.ApplicationResources"/> <message-resources key="menu" null="false" parameter="blabla.menu.ApplicationResources"/>. And in my JSP, I have: <bean:message bundle="context" key="myLocale"/> => When I want to display the page, I get the following error: "Cannot find message resources under key 'context'" However, if I add the module context path, it works: <bean:message bundle="context/path_to_my_module" key="myLocale"/>. I'm quite surprised that struts does not add this "path_to_my_module" by itself..., and I don't like the idea to "hardcode" my module path in each <bean:message> bundle property... Thanks in advance, J�r�my [ September 29, 2005: Message edited by: Jeremy Tukif ]
|
 |
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
I also need to resolve this.
Anyone have a solution to this?
|
 |
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
I digged into the pageContext. I found this below which I will use as a workaround now.
In summary, the module prefix is in the request context.
Example: if your module name is APPLE, the above will return /APPLE
that is, with a slash.
|
 |
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
I created a custom tag. (geez, i am hoping i researched enough that there is no existing tag like this....or im wasting my time)
usage
tag lib section
|
 |
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
|
A couple of weaknesses for the above solution is if you happen to use for some reason, iframe and window.open to open a jsp directly without passing through struts, as the request context wouldnt contain the struts attribute we need.
|
 |
 |
|
|
subject: Message resources and struts modules
|
|
|