You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Seaman, Sloan" <Sl...@ptilabs.com> on 2004/08/10 16:44:34 UTC

TagLib

This isn't a struts specific question (more towards tag-libs) but I figure
it is worth asking:

Why does org.apache.taglivs.standard.tag.common.sql.DataSourceUtil assume
that the datasource is within java:comp/env?

What if you loaded it outside of Tomcat into another namespace (since Tomcat
makes java:comp/env read-only) so that your app is not tied to Tomcat's
server.xml file (in case you would want to change web servers easily)?

If I want to use <sql:query> I have to now load my datasource in Tomcats
context configuration because of this.

Just curious if there is a set standard that says I have to use
java:comp/env and therefore am tied to Tomcat's config file since it makes
it read-only after initialization.

Thanks!
--
Sloan


Re: TagLib

Posted by Craig McClanahan <cr...@gmail.com>.
On Tue, 10 Aug 2004 10:44:34 -0400, Seaman, Sloan
<sl...@ptilabs.com> wrote:
> This isn't a struts specific question (more towards tag-libs) but I figure
> it is worth asking:
> 
> Why does org.apache.taglivs.standard.tag.common.sql.DataSourceUtil assume
> that the datasource is within java:comp/env?
> 

The "java:comp/env" context is the J2EE standard location for
components ("comp") provided by the container to the environment
("env") of the application.  As such, you will find it to be portable
across any app server that implements JNDI resources in the J2EE
standard way (including Tomcat).

> What if you loaded it outside of Tomcat into another namespace (since Tomcat
> makes java:comp/env read-only) so that your app is not tied to Tomcat's
> server.xml file (in case you would want to change web servers easily)?
> 

Every server will have it's own way of *configuring* resources into
the standard environment, and those mechanisms will be
server-dependent.  However, the application using those resources will
remain portable.

> If I want to use <sql:query> I have to now load my datasource in Tomcats
> context configuration because of this.
> 

Only if you're using Tomcat.  On some other server, you'd use that
server's initialization mechanism -- but your application would still
work.

> Just curious if there is a set standard that says I have to use
> java:comp/env and therefore am tied to Tomcat's config file since it makes
> it read-only after initialization.
> 
> Thanks!
> --
> Sloan
> 
> 
Craig

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