File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Message resources and struts modules

 
Jeremy Tukif
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2068
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also need to resolve this.

Anyone have a solution to this?
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2068
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2068
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic