tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Delisle <Pierre.Deli...@Sun.COM>
Subject Re: Getting web app context?
Date Thu, 08 Jan 2004 20:45:01 GMT
Since you tried <c:url value="Action.do"/>, and said it did not
work...

It would also work with the following:

  <c:url value="/Action.do" var="url1"/>
  <c:url value="Foo.do" var="url2">
    <c:param name="_doneURI" value="${url1}"/>
  </c:url>
  <a href='<c:out value="${url2}"/>'>Link</a>

Your URL has to start with "/" to have the context
path prepended.

>From the spec, section 7.5:

  The URL must be either an absolute URL starting with a scheme
  (e.g. "http:// server/context/page.jsp") or a relative URL as
  defined by JSP 1.2 in JSP.2.2.1 "Relative URL Specification". 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.

    -- Pierre


otisg wrote:

> Thank you, that does it.  I just found it in Sun's JSTL
> tutorial.  I hate when this happens :)
> 
> Otis
> 
> 
> 
> 
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 
> 
> ---- On Thu,  8 Jan, Kris Schneider (kris@dotech.com) wrote:
> 
> 
>>pageContext.request.contextPath
>>
>>Quoting otisg <otisg@ureach.com>:
>>
>>
>>>Hello,
>>>
>>>I am trying to do something like this in a JSP:
>>><a href="
>>><c:url value="Foo.do">
>>>  <c:param name="_doneURI" value="/MYAPP/Action.do"/>
>>></c:url>"></a>
>>>
>>>That /MYAPP part is hard-coded, and I would like ot replace
> 
> it
> 
>>>with a piece of JSTL that would always put the name of the
>>>current web application context there.
>>>
>>>Is there a way to do this in JSTL?
>>>
>>>I am looking at the JSTL reference (Appendix from JSTL in
>>>Action), but see nothing that will do that.... but I
> 
> suspect
> 
>>>that I'm just not seeing it, and that there is a nice,
> 
> elegant
> 
>>>way of doing this using JSTL.
>>>
>>>I've tried using the following in place of MYAPP above:
>>>
>>>  <c:url value="Action.do"/>, but that didn't work :(
>>>
>>>I actually couldn't even get this to work:
>>>
>>>  <c:out value="<c:url value="Action.do"/>"/>
>>>
>>>
>>>Thanks,
>>>Otis
>>
>>-- 
>>Kris Schneider <mailto:kris@dotech.com>
>>D.O.Tech       <http://www.dotech.com/>
>>
>>
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail:
> 
> taglibs-user-unsubscribe@jakarta.apache.org
> 
>>For additional commands, e-mail:
> 
> taglibs-user-help@jakarta.apache.org
> 
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message