How to run Servlets on Apache tomcat 4.1?

dorai007

Geek Trainee
Guys, ive got a file testServlet.java(below) .Its a servlet and the problem is i cant view it on apache tomacat server.Ive been getting 404 error persistently.Please some1 tell me how to run servlets and which directory to place them so that i can view them on the server(http://localhost:8080/)

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class testServlet extends HttpServlet {

public void init(ServletConfig config) throws ServletException
{
super.init(config);
}

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
System.out.println("testing Servlet");

String name = request.getParameter("name");
System.out.println("Hello "+name);

}

public void destroy()
{ }
}
 
Back
Top