tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Si <Jim...@CalgaryHealthRegion.ca>
Subject Re: First Servlet 404 error
Date Fri, 29 Aug 2003 18:04:28 GMT
Thank you Stuart for your great help.

HellowWorld servlet works! But I still have one problem.

I got login.jsp in the webapps\onjava directory.  It has
    <form name="loginForm" method="POST" action="servlet/com.onjava.login">

In login.java, it has
 private String target = "/welcome.jsp";
...
  // Forward the request to the target named
  ServletContext context = getServletContext();
  RequestDispatcher dispatcher = context.getRequestDispatcher(target);
  dispatcher.forward(request, response);

In welcome.jsp, it has very simple return statement.
   <b>Welcome : <%= request.getAttribute("USER")

In webapps\onjava\Web-inf\web.xml, I have
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>com.onjava.login</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/servlet</url-pattern>
</servlet-mapping>

In a browser, I use http://localhost:8080/onjava/login.jsp and I got the login
screen, then click on submit button.  I got the following error.

HTTP Status 404 - /welcome.jsp
description The requested resource (/welcome.jsp) is not available.

Look like it runs the login class, how do I correct this problem?  Thank you.

> Also, make sure your HelloWorld servlet is mapped-in in your webapps
> deployment descriptor.  By the way, the folder should be called WEB-INF not
> web-inf.
>

Windows somehow change WEB-INF to Web-inf automatically.  I could not use
WEB-INF.

Jim


Mime
View raw message