You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Tim Burrell <tb...@nixnerd.net> on 2005/07/10 22:53:02 UTC
two slashes problem ...
Hello.
There was a bug (105695) that was fixed in 1.2.6 of struts.
Basically, if your application is the root application, the following:
<html:link action="/MyAction">
would yield the following html:
<a href="//MyAction.do">
The 2 slashes were a problem. This bug, I believe has been fixed.
My problem is with the following 2 scenarios:
html:link page
html:img page
I think these may have been overlooked with the fix to 105695. I
think I may have fixed them, though. I'm not sure how to submit the
fixes, though.
Here are diff outputs for the 3 files (TagUtils.java, ImageTag.java,
and ImgTag.java):
TagUtils.java
436,442c436
< String contextPath = request.getContextPath();
<
< // Avoid setting two slashes at the beginning of an
action:
< // the length of contextPath should be more than 1
< // in case of non-root context, otherwise
length==1 (the slash)
< if (contextPath.length() > 1) url.append(contextPath);
<
---
> url.append(request.getContextPath());
453,459c447
< String contextPath = request.getContextPath();
<
< // Avoid setting two slashes at the beginning of an
action:
< // the length of contextPath should be more than 1
< // in case of non-root context, otherwise length==1
(the slash)
< if (contextPath.length() > 1) url.append(contextPath);
<
---
> url.append(request.getContextPath());
ImageTag.java:
220,231c220
<
< String contextPath = request.getContextPath();
< StringBuffer rv = new StringBuffer();
<
< // Avoid setting two slashes at the beginning of an
action:
< // the length of contextPath should be more than 1
< // in case of non-root context, otherwise length==1
(the slash)
< if (contextPath.length() > 1) rv.append(contextPath);
<
< rv.append(pageValue);
<
< return rv.toString();
---
> return (request.getContextPath() + pageValue);
259,270c248
<
< String contextPath = request.getContextPath();
< StringBuffer rv = new StringBuffer();
<
< // Avoid setting two slashes at the beginning of an
action:
< // the length of contextPath should be more than 1
< // in case of non-root context, otherwise length==1
(the slash)
< if (contextPath.length() > 1) rv.append(contextPath);
<
< rv.append(pageValue);
<
< return rv.toString();
---
> return (request.getContextPath() + pageValue);
ImgTag.java
551,562c551
<
< String contextPath = request.getContextPath();
< StringBuffer rv = new StringBuffer();
<
< // Avoid setting two slashes at the beginning of an
action:
< // the length of contextPath should be more than 1
< // in case of non-root context, otherwise length==1
(the slash)
< if (contextPath.length() > 1) rv.append(contextPath);
<
< rv.append(pageValue);
<
< return rv.toString();
---
> return (request.getContextPath() + pageValue);
587,598c576
<
< String contextPath = request.getContextPath();
< StringBuffer rv = new StringBuffer();
<
< // Avoid setting two slashes at the beginning of an
action:
< // the length of contextPath should be more than 1
< // in case of non-root context, otherwise length==1
(the slash)
< if (contextPath.length() > 1) rv.append(contextPath);
<
< rv.append(pageValue);
<
< return rv.toString();
---
> return (request.getContextPath() + pageValue);
Also, please let me know if I'm exhibiting improper "list
etiquette". I'm kinda new to this. :\
Thanks, folks.
tb
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org