tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject Re: Context path
Date Sun, 16 Nov 2003 16:54:13 GMT
((HttpServletRequest)pageContext.getServletRequest()).getContextPath()

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/servletapi/javax/servlet/jsp/PageContext.html#getRequest()

But using ServletContext.getResourceAsStream("/stuff") is relative to the 
Servlet Context's root dir which should not have the Context Path.

-Tim

Sjoerd van Leent wrote:

> Hi all,
> 
> I want to get the context path for use in a Taglib. Suppose the following
> tag entry:
> 
> <mylib:load func="/WEB-INF/File.file" />
> 
> And the following class belongs to it:
> 
> public class Load {
> 	private String func;
> 
> 	public void setFunc(String func){...}
> 
> 	public doStartTag() throws JspException {
> 		//... Display contents of this.func
> 	}
> }
> 
> I want to locate the File.file from the root of the context and display it
> in the page for example, how can I say to a FileReader that it has to use
> this file? 



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


Mime
View raw message