• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access a (non default) resource bundle from .jsp

 
Norman Rozental
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there folks,
I've got in my .jsp:
In my struts-config-moduleName.xml file I've defined:

I'm getting the error:

I posted an earlier message asking how to obtain this bundle from within the Action class and had a reply which showed how to do this. But now I'm stuck with the .jsp way of accessing a bundle.
Any help would be most appreciated!
Happy new year!
Norman
 
Norman Rozental
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I found the way to do it...
In my Action, I do:

I then include it as an belonging to the
Eg,
Then in my .jsp I've got:

And that's it. It works ok. Is this the proper way of doing things?
Cheers.
Norman.
 
Rick Hightower
Author
Ranch Hand
Posts: 350
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not have to do that. Do this instead.

[ December 30, 2003: Message edited by: Rick Hightower ]
 
Norman Rozental
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rick,
I tried what you suggested and get the error:

where xxx is the key defined as a message-resource in my struts-config-module.xml file.
I am using request scope. Would this cause a problem? Maybe what you suggest can only be applied to the default struts-config.xml file?
Confused.
Normie.
 
Benson Fung
Ranch Hand
Posts: 214
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norman,

I got the same as you have right now. It seems it doesn't work in struts-config-moduleName.xml file.

Do you have alternatives? Becasue I don't want to use programming to config the resources bundle.


Thanks
Benson
 
Hao Zhang
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same problem, I think it must be a bug of struts 1.1,
but I found JSPs in module can get the default resources, so I define common messages in struts-config.xml like this:

then in JSP use:

to retrive "mykey" message. besides, <bean:write> tag without bundle property specified can get module messages as well.
BTW, the validator plugin's standard messages can not be found anyway.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic