Results 1 to 2 of 2
  1. #1
    Alan is offline Member
    Join Date
    May 2007
    Posts
    39
    Rep Power
    0

    Default servlets and myjavaserver

    I have a problem and not I don´t know where I have the mistake.
    I have a count in myjavaserver and I am trying to test a servlet but I don´t obtain good results the page always returns me "404 not found".

    in the root of my directory I have this:
    /WEB-INF/classes/com/bloodredsun/servlet/

    inside of this I have this file:
    ExampleServlet.class
    this servlet has that:
    response.getWriter().println("<b>hello</b>world!!!")"

    in web.xml I have this:
    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> 
    <web-app> 
      <servlet>
        <servlet-name>ExampleServlet</servlet-name>
        <servlet-class>com.bloodredsun.servlet.ExampleServlet</servlet-class>
      </servlet> 
      <servlet-mapping>
        <servlet-name>ExampleServlet</servlet-name>
        <url-pattern>/ExampleServlet.do</url-pattern>
      </servlet-mapping> 
    <session-config>
        <session-timeout>
                30
            </session-timeout>
      </session-config>
      <welcome-file-list>
        <welcome-file>
                index.jsp
            </welcome-file>
        <welcome-file>
                index.html
            </welcome-file>
        <welcome-file>
                index.htm
            </welcome-file>
      </welcome-file-list>
    </web-app>
    When I write this link:

    http://www.myjavaserver.com/~afluben...mpleServlet.do

    this message appear:
    The requested URL /~aflubenov/ExampleServlet.do was not found on this server.
    Do you know what is happening?
    thank a lot
    alan
    Last edited by Alan; 06-01-2007 at 01:49 AM.

  2. #2
    jitendra.ibs is offline Member
    Join Date
    Jun 2007
    Posts
    2
    Rep Power
    0

    Default

    <servlet-mapping>
    <servlet-name>ExampleServlet</servlet-name>
    <url-pattern>/ExampleServlet.do</url-pattern>
    </servlet-mapping>

    i n place of this mapping u try
    <servlet-mapping>
    <servlet-name>ExampleServlet</servlet-name>
    <url-pattern>/servlet/ExampleServlet</url-pattern>
    </servlet-mapping>

    it will work

Similar Threads

  1. 1 form 2 servlets
    By sandor in forum Java Servlet
    Replies: 2
    Last Post: 01-22-2008, 10:47 AM
  2. Deploying Servlets
    By gapper in forum New To Java
    Replies: 2
    Last Post: 01-17-2008, 12:43 PM
  3. servlets or jsp
    By krishnapal in forum Advanced Java
    Replies: 1
    Last Post: 12-13-2007, 02:31 PM
  4. Servlets
    By nagaroopanandha in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 02:09 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
  •