tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anil Philip" <anil.phi...@openwave.com>
Subject RE: Deploying a Servlet to Tomcat 5.0
Date Wed, 26 Jan 2005 18:44:49 GMT
See http://www.coreservlets.com/Apache-Tomcat-Tutorial/#Download-Tomcat


-----Original Message-----
From: Harsha perera [mailto:harsha_l_perera@yahoo.com] 
Sent: Tuesday, January 25, 2005 12:04 AM
To: tomcat-user@jakarta.apache.org
Subject: Deploying a Servlet to Tomcat 5.0

Hi,

I have been trying to deploy a simple servlet to
Tomcat 5.0. Tomcat is installed on WIndows XP.

This is what I did:
1. Created a directory structure under 
   $TOMCAT_HOME\webapps as follows:
   ROOT\WEB-INF\classes

2. Moved the class(HelloServlet.class) to the
   above created directory.

3. Bounced Tomcat.

4. Attempting to access the class as 
   http://localhost:8080/servlet/HelloServlet gives 
   me the error:
   HTTP Status 404 - /servlet/HelloServlet

----------------------------------------------------------------------------
----

type Status report

message /servlet/HelloServlet

description The requested resource
(/servlet/HelloServlet) is not available.


Please advise on how I should be deploying this simple
servlet. 

The servlet is code is given below:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

/** Simple servlet used to test server.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages 2nd
Edition
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2003 Marty Hall; may be freely used or
adapted.
 */

public class HelloServlet extends HttpServlet {
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String docType =
      "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 "
+
      "Transitional//EN\">\n";
    out.println(docType +
                "<HTML>\n" +
                "<HEAD><TITLE>Hello</TITLE></HEAD>\n"
+
                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                "<H1>Hello</H1>\n" +
                "</BODY></HTML>");
  }
}



Regards
Harsha

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message