• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 350
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic