You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashish Kulkarni <ku...@yahoo.com> on 2002/09/19 20:34:30 UTC

Getting Message from properties file in servlet

Hi,
If i have to get messages from properties file and
display them in jsp i use <bean:message
key="index.title"/>
tag to do so,
if i want to get this same message in my servlet how
can i do it, i want this message as String in servlet

Ashish

=====
A$HI$H

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Getting Message from properties file in servlet

Posted by James Mitchell <jm...@telocity.com>.
Hi, sorry for the delay.  Had family chores (my son's soccer practice) to
do.

> This works fine when i have only one properties file for english

If this work for you in english, then it should work for all others.

Have a good one!!!


James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Getting Message from properties file in servlet

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi James
it does not work that way , what i have done is the
following..
MessageResources mr =
MessageResources.getMessageResources("com.pfizer.maps.maps");
where "com.pfizer.maps.maps" is my properties file,
defined in web.xml, 
String message = mr.getMessage(locale, key);

This works fine when i have only one properties file
for english, can u test if this will work in
internaltiozation, say i have one more properties filr
"com.pfizer.maps.maps_fr",
will this same code work.
Ashish



--- James Mitchell <jm...@telocity.com> wrote:
> <Off-the-top-of-my-head/>
> If your servlet is running in the same web app as
> your struts app, (I think)
> you should be able to:
> 
> **warning - this is only from memory***
> 
>   MessageResources mr =
>
servletcontext.getAttribute("org.apache.struts.MESSAGE");
>   mr.getMessage("index.title");
> 
> 
> 
> James Mitchell
> Software Engineer\Struts Evangelist
> Struts-Atlanta, the "Open Minded Developer Network"
> http://www.open-tools.org/struts-atlanta
> 
> 
> 
> 
> > -----Original Message-----
> > From: Ashish Kulkarni
> [mailto:kulkarni_ash1312@yahoo.com]
> > Sent: Thursday, September 19, 2002 2:35 PM
> > To: Struts Users Mailing List
> > Subject: Getting Message from properties file in
> servlet
> >
> >
> > Hi,
> > If i have to get messages from properties file and
> > display them in jsp i use <bean:message
> > key="index.title"/>
> > tag to do so,
> > if i want to get this same message in my servlet
> how
> > can i do it, i want this message as String in
> servlet
> >
> > Ashish
> >
> > =====
> > A$HI$H
> >
> > __________________________________________________
> > Do you Yahoo!?
> > New DSL Internet Access from SBC & Yahoo!
> > http://sbc.yahoo.com
> >
> > --
> > To unsubscribe, e-mail:
> >
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
A$HI$H

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Struts1.1.b2 and Menu

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,

I have a javascript which populates a drop down menu, 
now i want to integrate in struts,
So suppose i have a menu item which calls AddUser.jsp,
In my previous version , u se to give a total path
like
http://servername:8080/maps/pages/AddUser.jsp in my
menu so i can call it from any level, 
so how can i write a Action Class to call this
AddUser.jsp, what definiation i need in struts-config
file file, and what is need in my javascript path
definition( how do i replace the abouve total path)

Ashish

=====
A$HI$H

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Struts1.1.b2 and stop Debug messages

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,
I m using struts1.1.b2 for developing my web
application,
but there are so many debug messages generated my
struts that i cannot find my message in std.out file ,
is there a way i can stop these messages comingin mt
std.out file

Ashish

=====
A$HI$H

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Getting Message from properties file in servlet

Posted by James Mitchell <jm...@telocity.com>.
<Off-the-top-of-my-head/>
If your servlet is running in the same web app as your struts app, (I think)
you should be able to:

**warning - this is only from memory***

  MessageResources mr =
servletcontext.getAttribute("org.apache.struts.MESSAGE");
  mr.getMessage("index.title");



James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta




> -----Original Message-----
> From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
> Sent: Thursday, September 19, 2002 2:35 PM
> To: Struts Users Mailing List
> Subject: Getting Message from properties file in servlet
>
>
> Hi,
> If i have to get messages from properties file and
> display them in jsp i use <bean:message
> key="index.title"/>
> tag to do so,
> if i want to get this same message in my servlet how
> can i do it, i want this message as String in servlet
>
> Ashish
>
> =====
> A$HI$H
>
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>