try changing the fileextension from .jsp to .inc
and use <jsp:include page="" /%>
-----Original Message-----
From: Hans Bergsten [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 10, 2001 5:15 PM
To: [EMAIL PROTECTED]
Subject: Re: include and forward error
Kishor K wrote:
>
> hi,
> I need clarification two errors I am getting.
> i am using apache 1.3.20 with tomcat 3.2.3.
>
> i have the following directory structure
>
> ROOT-> example
>
> there is a file file1.jsp in example directory
> in this file i am trying to include a file incfile.jsp in the ROOT
directory
> using
>
> <%@ include file="../incfile.jsp"%>
> in this case i am getting the following error
>
> org.apache.jasper.compiler.CompileException:
> D:\jakarta-tomcat\webapps\ROOT\example\file1.jsp(43,0) Bad file argument
to
> include
> [...]
> and
>
> there is another file file2.jsp in example directory
> in this file i am trying to forward to a file forwfile.jsp in the ROOT
> directory using
>
> <jsp:forward page="../forwfile.jsp">
> </jsp:forward>
>
> in this case i am getting the following error.
>
> Original request: /example /../forwfile.jsp
> Not found request: /example /../forwfile.jsp
>
> Can anyone out thr help me with these ?
You're not allowed to include or forward to pages that are part of
another application (think "security risks") using the JSP elements.
If the container allows it, you may be able to get hold of the servlet
context for the other application, and then get a RequestDispatcher for
the page in that application. You can then use the RequestDispatcher
to include/forward to the page. Something like this:
<%
ServletContext ctx = application.getServletContext("/otherapp");
RequestDispatcher rd = ctx.getRequestDispatcher("/foo.jsp");
rd.forward(request, response);
%>
But you may want to rethink the design. A web application is supposed
to be self contained, so this type of coupling between apps may cause
problems. Maybe all pages should actually be part of the same app
instead.
As an alternative to a forward, maybe a redirect to the other app is
more appropriate.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets