You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Nelson, Laird" <La...@FMR.COM> on 2002/11/22 20:10:55 UTC

RE: [Unverified Sender] RE: servletMapping field in ActionServlet (1.0.2)

> -----Original Message-----
> From: Nelson, Laird [mailto:Laird.Nelson@fmr.com]
> OK.  So not even an extra optional attribute on the form tag 
> somewhere ("Use
> servletPath X instead of servletPath Y"), bearing in mind the 
> limitations of
> our current reporting requirements?

Following up my own message: or how about simply using the servlet path
instead of the servlet mapping when you're not using extension mapping?

Something like this (starting at line 713 in ...taglib.html.FormTag in the
getActionMappingURL() method; I changed the final else block as follows):

    if (servletMapping.startsWith("*.")) {
        value.append(actionMapping);
        value.append(servletMapping.substring(1));
    } else {
        // In the case of path mapping, just use the servlet path,
        // since we are guaranteed by the 2.2 spec that it will reflect
        // the correct servlet mapping
        value.append(pageContext.getRequest().getServletPath());
        value.append(actionMapping);
    }

(Warning: code is untested, but you get the idea.)

The basic gist is that if path mapping is in effect, use the servlet path
instead, because the servlet 2.2 specification, section 5.4, guarantees that
the servlet path will be what you want.  Or, another way to put it is that
the servlet mapping is only really important when it's extension mapping, as
far as I can tell, since the servlet path will otherwise give you what you
want.

Cheers,
Laird

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