Bug 9968 - c:url prepends path to page relative URLs
Summary: c:url prepends path to page relative URLs
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.0
Hardware: Other other
: P3 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2002-06-18 20:39 UTC by Jon Pierce
Modified: 2010-01-03 00:24 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Jon Pierce 2002-06-18 20:39:25 UTC
Section 7.5 of the JSTL specification states:

"...[A]an implementation must prepend the context path to a URL that starts with
a slash (e.g. "/page2.jsp") so that such URLs can be properly interpreted by a
client browser."

To me, this implies that prepending ought not be done to a URL that does not
start with a slash (a page relative URL).  Yet the c:url tag prepends the
context path, and any context relative path information, to the URL, converting
"somepage.jsp" into "/context/path/somepage.jsp".  Though I can definitely see
uses for this, I'm not entirely sure this is the desired effect.  It would
certainly be useful to be able to get at the page relative URL ("sompage.jsp")
after having rewritten the URL with parameters and a session ID, if necessary. 
This would allow for the URL to be later used (e.g., conditionally) by
c:redirect.  Currently, using the generated URL in c:redirect redirects to
"/context/context/path/somepage.jsp", which of course does not exist as the
context path has been prepended twice.
Comment 1 Shawn Bayern 2002-07-15 00:40:26 UTC
Indeed, this was a bug.  Sorry for the delay; a fix is included in the current 
nightly builds and will be included in the next milestone and release.