This is the first example from hfs i am coding....am new to
tomcat ...used WSAD all along..soo
someone plz guide me
created a
servlet named Ch1Servlet as below:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Ch1Servlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException{
PrintWriter out= response.getWriter();
java.util.Date today = new java.util.Date();
out.println("<html><body><h1 align=center>HF Chapter1</h1>"+
"<br>+today+</body></html>");
}
}
created an xml file name web.xml as below:
<web-app xmls="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee"
web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Chapter1 Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Chapter1 Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
</servlet-mapping>
</web-app>
created the following directory tree under Tomcat directory
C:\Program Files\Apache Group\Tomcat 4.1\webapps\ch1\WEB-INF\classes
| |
| |
web.xml Ch1Servlet.class
and another directory tree
f:\project1
|
|
src classes etc
| |
| |
Ch1Servlet web.xml
.java
when i type
http://localhost:8080/ch1/Serv1 in browser i get the error message as:
HTTP Status 404 - /ch1/Serv1
--------------------------------------------------------------------------------
type Status report
message /ch1/Serv1
description The requested resource (/ch1/Serv1) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/4.1.30
can any1 plz explain the silly mistake i did here....