You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Matt Raible <ma...@raibledesigns.com> on 2002/06/04 17:59:23 UTC

Is it possible to do <%=request.getContextPath()%> with JSTL

It there an equivalent to <%=request.getContextPath()%> in JSTL?

 

Thanks,

 

Matt

 


Re: Is it possible to do <%=request.getContextPath()%> with JSTL

Posted by Hans Bergsten <ha...@gefionsoftware.com>.

Matt Raible wrote:
> It there an equivalent to <%=request.getContextPath()%> in JSTL?

<c:out value="${pageContext.contextPath}" />

If, however, you want this to convert a context-relative path to
an absolute path ("server-relative"), e.g. in an HTML element,
take a look at <c:url>:

   <img src="<c:url value="/images/foo.gif" />">

turns the context-relative path into an absolute path that the
browser knows how to deal with.

Hans

-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
JavaServer Pages	http://TheJSPBook.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Is it possible to do <%=request.getContextPath()%> with JSTL

Posted by Shawn Bayern <ba...@essentially.net>.
On Tue, 4 Jun 2002, Matt Raible wrote:

> It there an equivalent to <%=request.getContextPath()%> in JSTL?

<c:out value="${pageContext.request.contextPath}"/>

-- 
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com
(coming in July 2002 from Manning Publications)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>