You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2004/11/17 21:01:50 UTC

DO NOT REPLY [Bug 32283] New: - Two slashes created by TagUtils.getActionMappingURL for webapps in root context

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32283>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32283

           Summary: Two slashes created by TagUtils.getActionMappingURL for
                    webapps in root context
           Product: Struts
           Version: Unknown
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Custom Tags
        AssignedTo: dev@struts.apache.org
        ReportedBy: jan.kaiser@gmail.com


The Method getActionMappingURL in the class org/apache/struts/taglib/TagUtils
creates an URL starting with two slashes when the webapp is in the root context
(ContextPath="/"). This leads to problems when using the FormTag class, because
a form action="//Login.do" instead of action="/Login.do" then is created. 

I suggest the following change, hoping that it has no impact on other classes: 

public String getActionMappingURL(String action, String module, PageContext
pageContext, boolean contextRelative) {

  HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

  // change by Jan Kaiser to avoid setting two 
  // slashes at the beginning of an action
  String contextPath = request.getContextPath();
  StringBuffer value = new StringBuffer();
  // the length of contextPath should be more than in case of non root 
  // context, otherwise it is one (the slash)
  if (contextPath.length() > 1) value.append(contextPath);
  // end change

  // ... rest of the code is omitted here

}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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