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/09 23:17:08 UTC

DO NOT REPLY [Bug 32134] New: - Must use contextRelative to forward to Actions in Default module

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=32134>.
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=32134

Must use contextRelative to forward to Actions in Default module

           Summary: Must use contextRelative to forward to Actions in
                    Default module
           Product: Struts
           Version: 1.2.4
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Controller
        AssignedTo: dev@struts.apache.org
        ReportedBy: dhscn06@cstone.dhs.state.il.us


The new forward configuration encourages using the "module" element instead of 
the deprecated "contextRelative" element.  However, it fails in this case 
where we want to switch to the default module:

<forward name="HomePage" path="/HomePage.do" module="/" redirect="true" />

The calculated URL ends up //HomePage.do instead of /HomePage.do (double '/').

The workaround is to configure the "old" way:

<forward name="HomePage" path="/HomePage.do" contextRelative="true" 
redirect="true" />

My proposed fix is to change the "forwardURL" method in RequestUtils like this:

if(forward.getModule() != null) {
	prefix = forward.getModule();
	if ("/".equals(prefix) {	// new line
		prefix = "";		// new line
	}				// new line
}

This works for my situation, but should be verified by someone who knows the 
entire code base better.

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