You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Daniel Rabe <dr...@opentext.com> on 2003/12/19 18:28:49 UTC

How multiple servlet-mappings affect computed action path?

I started out with a simple struts webapp, so my web.xml maps *.do to
myServlet. Then I recognized a need to have a set of requests dispatched to
my servlet based on the first part of path_info, so I added a new mapping
from /special/* to myServlet. (These requests will NOT have ".do" at the
end.)

Now when I have a JSP with <html:form action="/myFormSave">, the action that
appears in the generated HTML is /myServlet/special/myFormSave.do instead of
just /myServlet/myFormSave. Why is this? How can I fix it?

Thanks,
Daniel Rabe


Re: How multiple servlet-mappings affect computed action path?

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Quoting Daniel Rabe <dr...@opentext.com>:

> I started out with a simple struts webapp, so my web.xml maps *.do to
> myServlet. Then I recognized a need to have a set of requests dispatched to
> my servlet based on the first part of path_info, so I added a new mapping
> from /special/* to myServlet. (These requests will NOT have ".do" at the
> end.)
> 
> Now when I have a JSP with <html:form action="/myFormSave">, the action that
> appears in the generated HTML is /myServlet/special/myFormSave.do instead of
> just /myServlet/myFormSave. Why is this? How can I fix it?
> 
> Thanks,
> Daniel Rabe
> 
> 


Struts does not support having the Action servlet mapped both ways ... you need
to choose one or the other.  Note that extension mappings still work even if
there are "directory levels" on the front of the URL.

If you really want URLs that are path mapped, tere are messages in the
STRUTS-USER mailing list archives about using filters to transform the incoming
URL for you (requires Servlet 2.3 or later).

Craig


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org