tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: servlet invoking
Date Tue, 30 May 2000 00:57:54 GMT
Hugh O'Brien wrote:

> Are you sure ?  My form still can't find my servlet.  He is my specific example
> I am working with.
>
> relevent piece of web.xml file
>
>  <servlet>
>   <servlet-name>ValidateSignupLogin</servlet-name>
>
> <servlet-class>com.intelis.webfe.servlets.signup.ValidateSignupLogin</servlet-class>
>
>   <load-on-startup>3</load-on-startup>
>  </servlet>
>
>  <servlet-mapping>
>   <servlet-name>ValidateSignupLogin</servlet-name>
>   <url-pattern>/ValidateSignupLogin</url-pattern>
>  </servlet-mapping>
>
> In my jsp
>
> <form name="CreateAccount" action="/ValidateSignupLogin"  method="POST">
> .....
> .....
> .....
> </form>
>
> The error I get is:
>
> Error: 404
>
> Location: /ValidateSignupLogin
>
> File Not Found
> /ValidateSignupLogin
>

Welcome to one of the most confusing aspects of programming for servlets and JSPs.

The issue here is that browsers interpret URLs differently than RequestDispatchers etc.
The browser sees "/ValidateSignupLogin" as relative to the document root of the entire
server, not the context root of your context.  Try this instead:

<form name="CreateAccount" action="ValidateSignupLogin" method="POST">

which will be resolved (by the browser) relative to your context root, instead of your
server -- as long as the JSP page itself is in the context root directory.

>
> -- Hugh W. O'Brien
>

Craig McClanahan



Mime
View raw message