tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Drye" <sd...@atg.com>
Subject Re: <exception> tag (was: Re: I18N: <bundle> Bug?)
Date Thu, 20 Dec 2001 17:45:34 GMT
Oh, I see the source of the confusion now... there are _two_ i18n taglibs in
the Jakarta taglibs project now... the i18n one, and the tags defined by
JSPTL.  The i18n one doesn't have the <exception> tag.

Stephen Drye
Art Technology Group

----- Original Message -----
From: "Stephen Drye" <sdrye@atg.com>
To: "Jan Luehe" <Jan.Luehe@Sun.COM>
Cc: <taglibs-user@jakarta.apache.org>
Sent: Thursday, December 20, 2001 10:39 AM
Subject: Re: <exception> tag (was: Re: I18N: <bundle> Bug?)


> > > The usual thing to do with exceptions in a i18n environment is to
throw
> a
> > > code for the message, not the actual message.  Then you just use the
> code as
> > > a key to look up the localized message in a properties file.  This way
> > > there's no need to use any custom exceptions.
> >
> > In the approach you are describing, the code (or key) of the exception
> message
> > is looked up in the application's configured resource bundle, and the
> > message it maps to is passed into the exception's constructor before the
> > exception is thrown, like this:
> >
> >   throw new XXXException(Resources.getMessage("SOME_ERROR_CODE"));
>
> Forgot to mention that the libraries I write that use this technique have
a
> getExceptionText(key, locale) static method.  So, the client code just
calls
> back into the library to get the text of the message after the exception
is
> caught.
>
> So, the lookup is TheLibrary.getException(except.getMessage(),
> response.getLocale()) in a JSP environment.
>
> Stephen Drye
> Art Technology Group
>


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message