I have a servlet file,like follows:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class a1 extends HttpServlet{
public void doGet(HttpServletResponse req,HttpServletResponse resp) throws ServletException,IOException{
PrintWriter pw=resp.getWriter();
pw.println("<html><body>Hello World!</body></html>");
pw.close();
}
}
and web.xml is follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>a1</servlet-name>
<servlet-class>a1</servlet-class>
</servlet>
</web-app>
I use Tomcat5.0,and I put a1.class into \Tomcat 5.0\webapps\test\WEB-INF\classes,and I have add a sentence into server.xml like follows:
<Context path="test" docBase="test" debug="0"/>
but when I run it in IE6,like follows:
http://localhost:8080/test/servlets/a1
it raises HTTP Status 404 error,"The requested resource (/test/servlets/a1) is not available."
Why? I have configure it! Please help.
Thanks in advance
Edward