tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Works with invoker servlet but not without
Date Sat, 04 Jan 2003 23:23:50 GMT


On Sat, 4 Jan 2003, Les Hartzman wrote:

> Date: Sat, 4 Jan 2003 14:57:12 -0800 (PST)
> From: Les Hartzman <les_hartzman@yahoo.com>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: Works with invoker servlet but not without
>
> I'm using Tomcat 4.1.18 on Linux.  When I deploy my
> app (war file in the 'webapps' directory) and the
> invoker servlet is uncommented from web.xml, my
> application works fine.
>
> I then comment out the invoker servlet, and remove all
> references in my JSPs to 'servlet' as part of form
> 'action' values, and the application stops working
> (resource ... is not available).
>
> As an example, if a form in a JSP has
> action="/myapp/servlet/MyServlet/NextJsp", I removed
> '/servlet'.  I have one servlet, MyServlet, that
> handles all of the control logic, so all 'actions'
> refer to this servlet.
>
> The servlet class is obviously defined, and the
> servlet mapping is as follows:
>
> <servlet-mapping>
>   <servlet-name>MyServlet</servlet-name>
>   <url-pattern>/myapp</url-pattern>
> </servlet-mapping>
>

The <url-pattern> value should be *context* relative, not *server*
relative.  In other words, it should not include the context path in it.
This makes sense when you understand that a webapp should work correctly
no matter what context path you deploy it on.

Try this instead:

  <servlet-mapping>
    <servlet-name>MyServlet</servlet-name>
    <url-pattern>/MyServlet/*</url-pattern>
  </servlet-mapping>

instead.

> This mapping is the same one that works when the
> invoker servlet is uncommented.
>
> Can someone please explain to me what is happening?
>
> Thank you.
>
> Les
>

Craig


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message