tomcat-users 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: Getting there: JServ to tomcat web.xml questions
Date Tue, 25 Jul 2000 21:26:56 GMT
Eric Princen wrote:

> OK. I'm well on my way now. Got the 2.2 spec. I'm understanding most
> things. I think I like it, but I'm not yet sure. :-)
>
> Some questions I can't find answers for. These are all questions about
> web.xml.
>
> I see the <init-param> element for <servlet>. I see the <context-param>
> for <web-app>. I need to pass the same variable "configFile" to all
> servlets in the context. I am making an assumption I do that with
> <context-param>, but it is unclear from the DTD that is in fact the
> case. Am I correct, or am I doing that annoying "assume" thing?
>

If you use <context-param>, these parameters are indeed accessible to all
the servlets in your web application.  You have to use calls like:

    getServletContext().getInitParameter("configFile")

to retrieve them in your servlets.

>
> I have two contexts and I would like them to use the same set of class
> files. As of now, I have my class files in WEB_INF/classes in each
> context's directory (still not working, but I'm sure it's a small
> error.) I would like to be able to give each context a path to where the
> servlet class files are. If that is not possible, can I symbolic link
> WEB-INF/classes to the servlet repository? That would be just too
> convienient, wouldn't it?
>

You can use a symbolic link (on Unix systems) for this purpose.
Alternatively, you could put your servlet classes on the system class path
instead, if they should be shared.

Note also that the class files themselves need to be nested (under
WEB-INF/classes) in directories that match their package name hierarchy,
following exactly the same rules as anytime you want to put a directory name
on a classpath.

>
> Is there a way to define a classpath for a context for support classes
> (not servlets?) These are classes I don't want to autoreload. Do I have
> to just rely on setting the CLASSPATH variable? I would like more
> control than that (but I'm well aware that you don't always get what you
> want.)
>

With Tomcat 3.2, that is one way to do it.  You should also note that any
JAR file in $TOMCAT_HOME/lib gets added to the class path automatically, so
that is a very convenient place to put shared libraries.

>
> That's all I have now, but I'm sure I'll think of more later. I always
> do. :-)
>
> Thank you all for your help to this point,
>
> -Eric ;-)
>
> --
> Eric Princen
> Chief Technology Officer
> BizBlast.com

Craig



Mime
View raw message