Thanks for all the help from everyone.  Using both GNUJSP and Tomcat this
worked for me.

Appreciate it,
George

-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 19, 2000 3:58 PM
To: [EMAIL PROTECTED]
Subject: Re: How to dynamicaly include files in jsp, not using<%@
include file="filename"%>?


"Manty, George" wrote:

> It appears to me as though there is no way to do this.  I think this
> functionality should be added to the JSP Spec.
>

It is, sorta ... see below.

>
> Right now, the only way it appears you can implement this is by hacking
the
> JSP engine code and you can only do this if you are using an open source
JSP
> engine.
>
> Anyone, have any other possible solutions?
>

The <%@ include file="..."%> directive is processed at the time your JSP
page is
compiled, not when it is executed.  Therefore, there is no opportunity for
you to
calculate the name of the file to be included, because your scriptlet (or
whatever)
isn't used until a request is made.

On the other hand, you can use <jsp:include> instead, for example:

    <%
        String pathname = "/page" + request.getParameter("page_number");
    %>
    <jsp:include page="<%= pathname %>" flush="true"/>

This works because <jsp:include> is processed at request time.

>
> Thanks,
> George
>

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
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".
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

Reply via email to