Results 1 to 2 of 2
  1. #1
    Dayanand is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default how to run servlet
    package com.lara;

    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import javax.servlet.ServletException;

    class HelloServlet extends HttpServlet
    public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
    PrintWriter out = res.getWriter();
    out.println("Hai Hai WELCOME MAN");
    i developed a class file by compiling the above in the same directory


    web.xml is also in the same directory

    but when i type http://localhost:7070/app1/callHello in the IE browser,i got the below errors
    HTTP Status 404 - Servlet hello is not available
    type Status report
    message Servlet hello is not available
    description The requested resource (Servlet hello is not available) is not available.
    Apache Tomcat/5.5.28

    i kept,HelloServlet.class,web.xml inside webapps folder of tomcat5.5
    whats the mistake in done
    Thanks in advance
    Last edited by Dayanand; 04-21-2011 at 08:34 AM.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Rep Power


    Quote Originally Posted by Dayanand View Post

    i kept,HelloServlet.class,web.xml inside webapps folder of tomcat5.5..
    Why did you put those files there?
    Read a tutorial that explains how to correctly package a war file so that you don't have to guess as to what goes where.

Similar Threads

  1. how can i link html+servlet+xml to form servlet
    By balachandarr in forum Java Servlet
    Replies: 0
    Last Post: 04-15-2009, 04:06 PM
  2. Servlet to Servlet connection through URLConnection
    By bsrjavaforum in forum Networking
    Replies: 0
    Last Post: 04-01-2009, 04:12 PM
  3. Replies: 1
    Last Post: 12-02-2008, 01:23 AM
  4. Replies: 0
    Last Post: 08-30-2008, 11:52 AM
  5. Replies: 1
    Last Post: 08-07-2007, 03:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts