DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5023>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5023 html:form does not handle "action" attribute correctly Summary: html:form does not handle "action" attribute correctly Product: Struts Version: 1.0 Final Platform: Other OS/Version: Other Status: NEW Severity: Blocker Priority: Other Component: Unknown AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The bug is in the handling of the "action" attribute of the html:form tag. The form tag does not correctly process URL's that do not either start or end with a wildcard ("*"). The symptom is that a legitimate URL (e.g. "/MyLink" in the web app with root context "/rootcontext" gets mapped to "/rootcontext" rather than either leaving it as the relative URL "/MyLink" (which is my preferred approach) or mapping it to a server relative URL "/rootcontext/MyLink" as happens to the wildcard URL's. The problem is in the FormTag.java file (no surprizes there). The following snippet is from that file and shows how the code does not handle the issue correctly. The stated aim of this method is to return the action converted to a server-relative URL. The method creates a variable called "value" which it manipulates then returns as the action. The "value" variable is initially set to the context root (e.g. "/rootcontext"). A series of "if/then/else" statements precludes further processing of the "value" variable until it is finnaly returned containg only the context root. The particular case that affects me now is when the servletMapping is not null, and the action does not contain a "?", and doesn't start with or end with a "*". /** * Return the form action converted into a server-relative URL. */ protected String getActionMappingURL() { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); StringBuffer value = new StringBuffer(request.getContextPath()); // Use our servlet mapping, if one is specified String servletMapping = (String) pageContext.getAttribute(Action.SERVLET_KEY, PageContext.APPLICATION_SCOPE); if (servletMapping != null) { String queryString = null; int question = action.indexOf("?"); if (question >= 0) queryString = action.substring(question); String actionMapping = getActionMappingName(); 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); } if (queryString != null) value.append(queryString); } // Otherwise, assume extension mapping is in use and extension is // already included in the action property else { if (!action.startsWith("/")) value.append("/"); value.append(action); } // Return the completed value return (value.toString()); } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>