Was just browsing thru validator sources and here is I think a "new"
non-deprecated way. Pelase, correct me if I am wrong someone.

So instead of 
   getResources().getMessage ("host.name");

One would do something like:

((MessageResources) request
       .getAttribute(Globals.MESSAGES_KEY)).getMessage (null,
"host.name");

null is for Locale if you have a locale you want the message for specify
it there, other wise default will be taken. 

Alex.

> -----Original Message-----
> From: Alex Shneyderman [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 06, 2003 9:55 AM
> To: 'Struts Users Mailing List'
> Subject: RE: How to use ActionError with two keys?
> 
> 
> You can get the value for your key like this from within your action.
> getResources().getMessage ("host.name")
> 
> so your resources:
> 
> errors.required=Required {0}
> host.name=Hostname
> 
> and the code:
> 
> new ActionError("errors.required", getResources().getMessage
> ("host.name"));
> 
> The only thing is this method getResources() is deprecated. But I am
sure
> there is some substitution for it.
> 
> Alex.
> 
> > -----Original Message-----
> > From: Zsolt Koppany [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, August 06, 2003 9:47 AM
> > To: Struts Users Mailing List
> > Subject: Re: How to use ActionError with two keys?
> >
> > And how can I do that?
> >
> > How can I get the string assigned to for example "errors.required"?
> >
> > Zsolt
> >
> >
> >
> >
> > On Wed, 2003-08-06 at 15:36, Prashanth.S wrote:
> > > Hi
> > > i think u need to use positional parameter substitution instead of
> using
> > another key
> > > like {0},{1} etc in actionerror and replace them with actual
values in
> > properties file..
> > > HTH
> > > prashanth
> > >
> > > Zsolt Koppany <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > how can I use ActionError with two keys. The example below show
what I
> > > would like to do:
> > >
> > >
> > > new ActionError("errors.required", "host.name")
> > >
> > >
> > >
> > > Zsolt
> > >
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail:
[EMAIL PROTECTED]
> > >
> > >
> > >
> > > ---------------------------------
> > > Do you Yahoo!?
> > > Yahoo! SiteBuilder - Free, easy-to-use web site design software
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to