((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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to