• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Accessing MessagResources within a jsp page

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone, no luck on the Struts Bean tags API and no luck googleing either...

I have a MessageResources file with my internationalised text, I would like to look up a particular key for displaying into a <html:link> tag



I know I can do this separately using


So basically, how can I get 2. and use it in 1. as the title?

Can I set up a local variable to store the value of the key I'm searching for and then use it?

I would rather not set it up on the session object if I can...

Thanx!
[ August 30, 2005: Message edited by: Fabricio Sanchez ]
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is one way:-


You can't embed custom tag in custom tag.
 
Fabricio Sanchez
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That does work in terms of the internationalisation side.

However, I miss out on the <html:link/> related attributes, such as the current struts module.

The code below:


Generates the following HTML:


The '/myModule' part of the href in number 2. is missing on the HTML.

Now,

Is there a better way to do what I am proposing?

(and if not)How can I get the current module (/myModule) output before the /myAction.do in the href part in number 2. ?

Thank you for your help!
 
Choon-Chern Lim
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah... if you are using straight HTML tag, then you have to specify the context path in front of *.do, in your case you need to insert "/myModule" to the href.

I just read another thread where you can specify something like that, if you are using JSP 2.0



The beauty of this is you don't hardcode your context path if it changes one day.
 
Fabricio Sanchez
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Genius! Thanx a lot Mike!
Just don't forget your '<c : out/>'s (or equivalents...)



I didn't know you could access the pageContext like that, I wonder what other kinds of usefull information you can access like that... Thanx again!

Fab

[ August 31, 2005: Message edited by: Fabricio Sanchez ]
[ August 31, 2005: Message edited by: Fabricio Sanchez ]
 
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic