hi,
in my question there is only one application.
i have some common files in the ROOT directory and other files in different
subdirctories.
common files are files which check accessrights,error page etc.
i would like to check the accessrights to the pages in the subdirectory by
including a file in ROOT and if the user doesn't have access he should be
forwarded to a page in the ROOT directory asking the user to log in.
ROOT -> MAIN
ROOT has accessrights.jsp and login.jsp
And there is a display.jsp in the MAIN directory.
accessrights.jsp should be included in display.jsp so that users access
rights can be checked (using username,password database)
If someone tries to access display.jsp thru browser. if the user does not
have access user should be forwared to login.jsp in the ROOT directory.
hope my question is clear now.
----- Original Message -----
From: "Hans Bergsten" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 10, 2001 5:15 PM
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
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.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