The way it nehaves is that "/" is the root of your webapp. So, when doing
things with the servlet container alone, you would reference the file as
"/JSPHeader.jsp". If, however, you are sending something to the browser for
it to get, then do "<%= request.getContextPath() %>/JSPHeader.gif"

Somewhat weird, but it does make navigation from the root of your webapp
easier since the name (context path) of the webapp can be changed.

Regards,
Paul


-----Original Message-----
From: Cor Ruiten [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 25, 2001 11:03 PM
To: [EMAIL PROTECTED]
Subject: Problems with context-relative path include directive


I just installed Tomcat 3.2.1 on my Windows 2000 workstation.

I am able to start Tomcat and view the examples provided in the
distribution.

I made the following entry in the server.xml file so that I can reach my
application:

        <Context path="/hcs"
                 docBase="d:/development/hcs/jsp"
                 crossContext="false"
                 debug="9"
                 reloadable="true" >
        </Context>

If I attempt to serve up any JSP page that has the following include
directive:

                <%@ include file="/hcs/JSPHeader.jsp" %>

I receive the following error:

         Error: 500
         Location: /hcs/sccp.jsp
         Internal Servlet Error:
         org.apache.jasper.compiler.CompileException:
D:\Development\hcs\jsp\sccp.jsp(0,0) Bad file
argument to include
         at
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
ntListener.java,
Compiled Code)
         at
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList
ener.java:116)
         at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java,
Compiled Code)
         at org.apache.jasper.compiler.Parser.parse(Parser.java, Compiled
Code)
         at org.apache.jasper.compiler.Parser.parse(Parser.java:1042)
         at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java,
Compiled Code)
         at
org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
         at
org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
         at
org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:433)
         at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:152)
         at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:164)
         at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java,
Compiled Code)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service(Handler.java:286)
         at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
         at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
         at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:2
10)
         at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
         at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
         at java.lang.Thread.run(Thread.java:479)

The same JSP pages work fine using JRun 3.0. But it appears that Tomcat is
not liking my
context-relative path include
statement because if I change the include to be:

                <%@ include file="JSPHeader.jsp" %>

and the JSP page that make this include is at the "root" level for my
context, then Tomcat is
happy...

I was under the impression that my definition of the "/hcs" context should
have taken care of this.

Any thoughts on what I am doing wrong here?

Thank you,

Cor Ruiten
Pipeline Software, Inc.
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to