Re: c:url and context path completion
Trenton Adams <[email protected]> Wed, 28 Nov 2007 14:32:22 -0700
| Newsgroups | gmane.comp.jakarta.taglibs.user |
|---|---|
| Message-ID | <[email protected]> |
Kris Schneider wrote: > On 11/28/07, Trenton Adams <[email protected]> wrote: > >> Kris Schneider wrote: >> >>> On 11/28/07, Trenton Adams <[email protected]> wrote: >>> >>> >>>> Kris Schneider wrote: >>>> >>>> >>>>> On 11/28/07, Trenton Adams <[email protected]> wrote: >>>>> >>>>> >>>>> >>>>>> Kris Schneider wrote: >>>>>> >>>>>> >>>>>> >>>>>>> On 11/28/07, Trenton Adams <[email protected]> wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> I was sure that I had read somewhere that "<c:url >>>>>>>> value="/images/pluslittle.gif"/>" usage would automatically cause the >>>>>>>> context path to be entered into the output of "c:url". Is that not >>>>>>>> correct? Because it's not working! >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> From the JSTL 1.1 Spec for <c:url>: >>>>>>> >>>>>>> As a consequence, 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. >>>>>>> >>>>>>> So, yes, the context should be prepended. What output are you actually seeing? >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> I'm seeing it produce "/images/pluslittle.gif", and it completely >>>>>> ignores the context path. I'm using tomcat 6 and java 1.5 >>>>>> >>>>>> >>>>>> >>>>> This wouldn't happen to be a JSP sitting in webapps/ROOT, would it? >>>>> Just checking... >>>>> >>>>> >>>>> >>>>> >>>> No, it's sitting in "webapps/appname/WEB-INF/jsp/otherdir/somejsp.jsp" >>>> >>>> >>> Oh well, worth a shot. I don't have TC 6 installed to test, but maybe >>> I'll do that later tonight. Does TC 6 come with an implementation of >>> JSTL 1.2 or are you using JSTL 1.1? Does your app use a Servlet 2.5 or >>> 2.4 web.xml? >>> >>> >>> >> I tried 5.5 just now, and it has the same problem. >> >> Tomcat 6 does not come with JSTL. >> >> web.xml is using 2.3 >> <!DOCTYPE web-app >> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" >> "http://java.sun.com/dtd/web-app_2_3.dtd"> >> >> >> I am using JSTL 1.1.2 >> > > For starters, try this: > > <web-app xmlns="http://java.sun.com/xml/ns/javaee" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee > http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" > version="2.5"> > ... > </web-app> > > No DOCTYPE. Unless your app really needs to be 2.3-based... > > No affect, still have the problem. I stopped tomcat, restarted, and removed the work directory for my context, just in case, but still see the problem. FYI: I'm initializing like so... <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%@ taglib uri="http://jakarta.apache.org/taglibs/benchmark-1.0" prefix="bm" %> I think I'll try a simple test case, like Hassan suggested.