Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Help Me on Servlet in Tomcat 5.0

athula bogoda

2006-12-28

Replies:

Hi All,

Can any body give me guidence to run my first servlet
on Tomcat 5.0.
This is my file...

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

public class HelloWorld extends HttpServlet {

  public void doGet(HttpServletRequest request,
HttpServletResponse response)
  throws IOException, ServletException
  {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Hello World!</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Hello World!</h1>");
    out.println("</body>");
    out.println("</html>");
   
  }
}


I compiled it(windows environment). But confused where
should i should put it and run on my local machine
typing http://localhost/

I go through several tutorials.But could not able to
success.If any one can help me it would be agreat
help.

Thanks.
Athula.

Send instant messages to your online friends http://uk.messenger.yahoo.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.