You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Terence Jacyno <tj...@galasoft.net> on 2001/11/06 23:12:55 UTC

Possible FormTag bug

Hi.

There seems to be a little bug in the way the FormTag's
getActionMappingURL() method converts the form action into a
server-relative URL.  Lines 725-732 (CVS version) read as follows:

            if (servletMapping.startsWith("*.")) {
                value.append(actionMapping);
                value.append(servletMapping.substring(1));
            } else if (servletMapping.endsWith("/*")) {
                value.append(servletMapping.substring
                             (0, servletMapping.length() - 2));
                value.append(actionMapping);
            }

which implies that when it comes to path mapping, the servlet mapping
has to end in "/*".  However, the servlet 2.2 spec states that "A string
containing only the ’/’ character indicates that servlet specified by
the mapping becomes the "default" servlet of the application" (p. 47,
section 10.2).  Therefore, if I understand correctly, the preceding code
should rather be as follows:

            if (servletMapping.startsWith("*.")) {
                value.append(actionMapping);
                value.append(servletMapping.substring(1));
            } else if (servletMapping.endsWith("/*")) {
                value.append(servletMapping.substring
                             (0, servletMapping.length() - 2));
                value.append(actionMapping);
            } else if (servletMapping.equals("/")) {
                value.append(actionMapping);
            }

Although specifying the default servlet mapping as "/*" works within
WebLogic, it is not so within the JBoss/Tomcat environment.  In fact,
specifying "/*" makes Tomcat map JSP files to the ActionServlet!

Thanks.

--
---------------------
Terence JACYNO
Galasoft Inc.



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