You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ti...@Bertelsmann.de on 2004/03/02 13:37:17 UTC

How do I access Message Resources in an Action?

Hey everybody!

Well the subject basically states my problem already. I'd like to create a
dynamical Navigation Bar that holds some pages you visited last. Therefore
I'd like to add Name, Link and Parameters to a Collection for later
printing. Problem is that the Name needs to come from the Message Resources,
and I don't know how to access those in an Action.
 
Can somebody help me?!
 
Thx!
 
P.S.: Can you guys access http://java.sun.com <http://java.sun.com>  ??!
Either my company's net is broken or the page is really down.

_______________________________________
Tim Adler, Abt. SDA1
Adress Management Solutions
AZ | Direct
Carl-Bertelsmann Straße 161s
D-33311 Gütersloh

Tel.: 05241/ 80 - 89574
tim.adler@bertelsmann.de 

 

Re: How do I access Message Resources in an Action?

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
I could send you off to look at the Javadoc, but sometimes working stuff 
out painstaking. Here's what I do:

MessageResources resources = (MessageResources)
         context.getAttribute(Globals.MESSAGES_KEY);
String msg = resources.getMessage("my.key");

Globals.MESSAGES_KEY is the default. If you set up other bundles, just 
change it appropriately. context is the page context - I took this from 
a taglib - you'd have to convert it to the servlet context I presume.

Adam

On 03/02/2004 01:37 PM Tim.Adler@Bertelsmann.de wrote:
> Hey everybody!
> 
> Well the subject basically states my problem already. I'd like to create a
> dynamical Navigation Bar that holds some pages you visited last. Therefore
> I'd like to add Name, Link and Parameters to a Collection for later
> printing. Problem is that the Name needs to come from the Message Resources,
> and I don't know how to access those in an Action.
>  
> Can somebody help me?!
>  
> Thx!
>  
> P.S.: Can you guys access http://java.sun.com <http://java.sun.com>  ??!
> Either my company's net is broken or the page is really down.
> 
> _______________________________________
> Tim Adler, Abt. SDA1
> Adress Management Solutions
> AZ | Direct
> Carl-Bertelsmann Straße 161s
> D-33311 Gütersloh
> 
> Tel.: 05241/ 80 - 89574
> tim.adler@bertelsmann.de 
> 
>  
> 


-- 
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: How do I access Message Resources in an Action?

Posted by James Mitchell <jm...@apache.org>.
The same way it is done in the struts-example.  Did you run that yet?


--
James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
678.910.8017
AIM: jmitchtx
MSN: jmitchell@apache.org



----- Original Message -----
From: <Ti...@Bertelsmann.de>
To: <st...@jakarta.apache.org>
Sent: Tuesday, March 02, 2004 7:37 AM
Subject: How do I access Message Resources in an Action?


Hey everybody!

Well the subject basically states my problem already. I'd like to create a
dynamical Navigation Bar that holds some pages you visited last. Therefore
I'd like to add Name, Link and Parameters to a Collection for later
printing. Problem is that the Name needs to come from the Message Resources,
and I don't know how to access those in an Action.

Can somebody help me?!

Thx!

P.S.: Can you guys access http://java.sun.com <http://java.sun.com>  ??!
Either my company's net is broken or the page is really down.

_______________________________________
Tim Adler, Abt. SDA1
Adress Management Solutions
AZ | Direct
Carl-Bertelsmann Straße 161s
D-33311 Gütersloh

Tel.: 05241/ 80 - 89574
tim.adler@bertelsmann.de






---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org