Women in Technology

Hear us Roar



Subject:   HTTP Status 404 - /
Date:   2006-08-26 00:08:15
From:   aadityasharma
Response to: HTTP Status 404 - /

type Status report


message //


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

Main Topics Newest First

Showing messages 1 through 1 of 1.

  • HTTP Status 404 - /
    2007-02-13 07:37:14  ritanegi [View]

    hello
    this is the servlet i wanted to run

    -------------------------------------------------
    import java.io.IOException;
    import java.io.PrintWriter;

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

    /*
    * Created on Jan 18, 2007
    *
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    */

    /**
    * @author Administrator
    *
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    */
    public class HelloServlet extends HttpServlet {
    public void doGet (HttpServletRequest req,
    HttpServletResponse res)
    throws ServletException, IOException
    {
    PrintWriter out = res.getWriter();


    out.println("Hello, world!");
    out.close();
    }
    }
    -------------------------------------------------
    this the web.xml file i created
    -------------------------------------------------

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>project.HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/servlet/project/HelloServlet</url-pattern>
    </servlet-mapping>
    </web-app>
    -------------------------------------------------
    this is the copy of manager saved by the name MyApp which is my project name too
    -------------------------------------------------
    <!--
    Context configuration file for the Tomcat Manager Web App

    $Id: manager.xml,v 1.2 2004/02/20 17:09:29 remm Exp $


    -->
    - <Context path="/Project" docBase="HelloServlet" debug="0" privileged="true">
    - <!-- Link to the user database we will get roles from
    -->
    <ResourceLink name="users" global="UserDatabase" type="org.apache.catalina.UserDatabase" />
    </Context>
    -------------------------------------------------
    my query is dat do i need to create n html file to display my output.......i haven't done it till now....i just went to my browser which is IE....n i have tomcat 5.0 installed in my system entered the url given below

    http://127.0.0.1:8080/example/servlet/HelloServlet

    but received n error report-http status 404 in the following form

    type Status report

    message /example/servlet/HelloServlet

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

    kindly check my servlet file coding as well as the web.xml file coding whether i have correctly coded them....the error may be thr due to wrong assignment.....i m just the beginner in web services

    i'll be grateful to u
    rita negi