Brad Johnson wrote:

> Hi all--
>
> I am a bit confused about creating a web app. in tomcat 3.1 (in conjunction
> with apache) and was wondering if one of you might be able to help me out.
> Apologize for the low-level question...
>
> Up to this point, we have configured the server.xml file such that it uses a
> <Context> tag to recognize an absolute URL in the global environment.  The
> path is called "/temp".
>
> under /temp we have created an WEB-INF dir.
>
> Points of confusion:
>
> 1) How to configure the WEB-INF dir.  It is my understanding that I need to
> register my servlets in a web.xml file in WEB-INF. Is that the only other
> file I need to change in order to run servlets?
>

The format of the web.xml file (i.e. the web application deployment descriptor)
is defined in the Servlet Specification, version 2.2, which you can download
from <http://java.sun.com/products/servlet>.

If you are going to invoke your servlet with a "/servlet/xxxxx" type path, you
don't really need to customize the web.xml file -- just copy the one from the
examples application.  If you want to define specific path for your servlet, you
would add a <servlet-mapping> entry, as defined in the spec.

>
> 2) What is the difference between the web.xml file in jakarta-tomcat/conf
> and the web.xml files that reside within WEB-INF directories of individual
> web apps?  Do I need to configure both?
>

The web.xml file in the "conf" directory is the defaults for *all* web
applications in your Tomcat installation.  It is read first, prior to reading
your own, to establish the default values.  For instance, the fact that files of
type "*.jsp" are mapped to the JSP processing servlet happens because of the
entries found here.

You don't need to modify this file unless you want to change the defaults for
all your web apps.

>
> 3) Servlet .class files need to be found in WEB-INF/classes, but JSP files
> can reside anywhere in the web app. Is this so?  In that case, are jsp's
> registered differently than servlets?
>

JSP pages themselves should be in the same directories as the HTML pages and
images.  There is generally no need to register them at all, because of the
default mapping of all filenames with the "*.jsp" extension described above.

>
> I tried to follow the example web app that came with Apache, but felt like I
> was drifting farther and farther from shore.  Is there some sort of behind
> the scenes configuration that goes on in the example?
>

Besides reading your own web.xml file, Tomcat first reads
$TOMCAT_HOME/conf/web.xml to establish the defaults.

>
> Any help would be greatly appreciated.  Thanks!
>
> brad
>

Craig McClanahan

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to