I believe I have discovered an error in
org.apache.struts.taglib.html.FormTag.getActionMappingURL().

The following is the block of code with the error:

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);
}

The problem is simply that only 2 of the 3 cases for
servlet url-pattern mapping are handled.  These 3
cases can be found on page 76 of the Servlet 2.3
specification (in section SRV.11.2).  The 2 cases that
are handled by the above code block are url-patterns
starting with "/" and ending with "/*" and
url-patterns beginning with "*.".  The one case that
is lacking is the one where the url-pattern is "/",
which is a pattern that indicates that the servlet is
the default servlet of the application.

So if one attempts to use the <html:form> JSP tag
while having the action servlet url-pattern set to
"/", an empty string is generated for the action
attribute of the resulting HTML <form> element.

To remedy this, something similar to the following
could be used to patch the block of code:

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);
}


Best

Gabriel

__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to