| Article: |
Deploying Web Applications to Tomcat | |
| Subject: | make it work with version 4.18 and above | |
| Date: | 2003-05-14 08:20:02 | |
| From: | hkubba | |
|
An important addition is to be added here: in the web.xml we must have 2 tags inside the < web-app> tag, those are <servlet> and <servlet-mapping> so when the article says :
|
||
Showing messages 1 through 1 of 1.
-
make it work with version 4.18 and above
2003-05-25 09:10:52 anonymous2 [View]



My web.xml file looks as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>com.onjava.login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
</web-app>
My directory structure looks as follows:
<TOMCAT_HOME>\webapps\onjava
=====> images (directory)
=====> login.jsp
=====> welcome.jsp
=====> WEB-INF
==========> web.xml
==========> classes
===============> com
====================> onjava
==========================> login.class
==========================> login.java
I have set the ServletContext in Tomcat's server.xml. My XML statement looks as follows:
<Context path="/onjava" docBase="onjava"
debug="1" reloadable="true"/>
I was successfull in deploying an HTML and JSP application using Tomcat's administration tool and ant. I am always getting the HTTP 404 error when I am deploying servlets.
Any help is highly appreciated.
Thank you.