Tag URL is buggy for context "/". <c:url context="/" value="/something.jsp"/> produce "//something.jsp" this is interpreted by browser (Galleion 1.3.5) as host name, not as absolute path . Correct result is "/something.jsp"
Hummm, The 'context' attribute is to be used to specify a *foreign* context. From the spec: Name of the context when specifying a relative URL resource that belongs to a foreign context. Specifying '/' does not represent a valid foreign context, and therefore leads to the problem you're having. If a resource belongs to the current context, attribute context should not be used.
I hope that '/' is valid foreign context, if context-root element in application.xml is '/'. For example, this is my application.xml: <application> <module> <web> <web-uri>hyperion-frontend.war</web-uri> <context-root>/</context-root> </web> </module> <web> <web-uri>hyperion-backend.war</web-uri> <context-root>hyperion-admin</context-root> </web> </module> </application> I need generate link from backend application to frontend application. Applications have diferent contex, attribute 'context' of tag 'c:url' must be supplied There is some.jsp in hyperion-backand.war with this tag: <c:url var="frontendLinkURL" value="/main.jsp" context="/"/> It generate <a href="//main.jsp"/> :-( It's bad result, because many browsers interpret this as host name, not as absolute path at same host. Correct result is <a href="/main.jsp"/> There is my patch: Index: UrlSupport.java =================================================================== RCS file: /home/cvspublic/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/core/UrlSupport.java,v retrieving revision 1.6 diff -u -r1.6 UrlSupport.java --- UrlSupport.java 4 Aug 2003 17:44:37 -0000 1.6 +++ UrlSupport.java 2 Sep 2003 13:51:17 -0000 @@ -189,7 +189,12 @@ if (!context.startsWith("/") || !url.startsWith("/")) throw new JspTagException( Resources.getMessage("IMPORT_BAD_RELATIVE")); - return (context + url); + if (context.equals("/")) { + // don't produce string starting with "//", many browsers interpreting this url as host name, not as absolute path on same host + return url; + } else { + return (context + url); + } } }
My bad, apologies... Just committed the fix for JSTL 1.1. Thanks for the bug report Cyril.