You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Les Hartzman <le...@yahoo.com> on 2003/01/04 23:57:12 UTC

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>

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



=====
--
-----------------------------------------------------------
Les Hartzman    "Those that don't read have no
                 advantage over those that can't."  -- Mark Twain



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Works with invoker servlet but not without

Posted by Les Hartzman <le...@yahoo.com>.
Thanks for the response.

Two questions about it:  1) why did it work with the
invoker servlet?  2) do I also change the form
'actions' to be '/MyServlet/NextJsp' from
'/myapp/servlet/MyServlet/NextJsp'?

Thanks.

Les

--- "Craig R. McClanahan" <cr...@apache.org> wrote:
> 
> 
> On Sat, 4 Jan 2003, Les Hartzman wrote:
> 
> > Date: Sat, 4 Jan 2003 14:57:12 -0800 (PST)
> > From: Les Hartzman <le...@yahoo.com>
> > Reply-To: Tomcat Users List
> <to...@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:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
--
-----------------------------------------------------------
Les Hartzman    "Those that don't read have no
                 advantage over those that can't."  -- Mark Twain



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Works with invoker servlet but not without

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sat, 4 Jan 2003, Les Hartzman wrote:

> Date: Sat, 4 Jan 2003 14:57:12 -0800 (PST)
> From: Les Hartzman <le...@yahoo.com>
> Reply-To: Tomcat Users List <to...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>