jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: i18n taglib submission (was RE: internationalization tags)
Date Mon, 05 Mar 2001 00:27:25 GMT
Tim Dawson wrote:

> JNDI is only used to look up the default bundle name if the localize tag
> does not provide one - and the only reason I used JNDI was that it seems to
> be the only way to access environment variables in the web application
> descriptor.  (which I think is a problem in the servlet spec) But
> theoretically since you're using JNDI to access a local web app descriptor,
> it's not going to go remote anyway. (I'm not a JNDI expert though - someone
> else who is please feel free to weigh in)

That depends totally on the JNDI implementation provided by your
container.  In
Tomcat 4.0, for example, this ends up looking in a local HashMap.

> That said, default bundle names still don't work for Tomcat 3.2.  I'm all
> for putting it somewhere that works for all environments, its just that I
> figured the web app descriptor was the best place to provide a default.

JNDI support is optional in non-J2EE containers.  We added it for Tomcat
however, because it's generally useful -- not just for environment
entries, but
also for database connection pools and other <resource-ref> entries.

> If we dropped the web app descriptor environment var approach and stored the
> bundle name in an application scoped variable, how would you recommend we
> make sure it gets set before the first page is hit?

The approach I use in Struts for stuff like this is to initialize them
in the
init() method of a servlet marked <load-on-startup>.  In an MVC app
where you've
got a controller servlet anyway, that is pretty straightforward --
otherwise you
need to document the required behavior in your docs.

In servlet 2.3 / JSP 1.2, you will have the additional capability to use
application event listener for this kind of thing.  Even better, you can
register an application event listener in the TLD of your library, so
that no
messing with the web.xml file is required.

> Tim

Craig McClanahan

View raw message