tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Tulley" <>
Subject RE: First Servlet 404 error
Date Sat, 30 Aug 2003 00:03:44 GMT
One more nit-pick.  As I said earlier, use "/servlet/login" instead of
"servlet/com.onjava.login".  Then you can turn off the InvokerServlet,
which could be used for security exploits.  Your current mapping (in
your last email) had 


What exactly are you trying to achieve here?  This is simply in error. 
Do you really want "/servlet" to map to your login servlet each and
every time?  You would not be able to have any other servlets in your
application.  Perhaps what you are trying to do is have all
unauthenticated requests to go to the login servlet?  To do this, use a
<security-constraint>, <login-config>, and <security-role> instead. 
(See Tomcat's admin and manager applications for an example).  Then you
can map all requests into your web app (the ones you want secured
anyway) to your login.jsp that you are working on.

I'm not sure if that will fix your welcome.jsp problem; probably not. 
Try removing the slash like Stuart said, though it should work either
way if welcome.jsp is in webapps/onjava/

- Jeff Tulley

>>> 8/29/03 5:36:36 PM >>>
Tomcat can usually find JSPs very easily.  Is welcome.jsp also in
CATALINA_HOME/webapps/onjava/ ?  Try the following:

private String target = "welcome.jsp";

If 'onjava' is your namespace then this might work.

-----Original Message-----
From: Jim Si [] 
Sent: 29 August 2003 19:04
To: Tomcat Users List
Cc: Stuart MacPherson
Subject: Re: First Servlet 404 error

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"

In, 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


In a browser, I use http://localhost:8080/onjava/login.jsp and I got
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? 

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

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


To unsubscribe, e-mail: 
For additional commands, e-mail: 

To unsubscribe, e-mail: 
For additional commands, e-mail: 

View raw message