"Khurram Mahmood (Outlook&Lotus Notes)" wrote:
>
> Hi,
>
> I have been trying to use the include directive to include files dynamically
> i.e. without hard-coding the path of the file.
>
> I have tried:
>
> <% String myFile = request.getParameter("strFileName"); %>
>
> <%@ include file="<%=myFile%>" %>
>
> and many different combinations of it but all of them fail to compile. I can
> not use the include action i.e. <%jsp:include page="<%=myFile%>" /> because
> it just includes the source as it without processing the file.
>
> Is there anyway of dynamically including the files in jsp1.0??? BTW, in case
> it matters, I am using JRUN.
>
> Thanks. I would really appreciate any help.
You can not use the include directive (<%@ include ... %>) with a dynamic file
name, because this type of include happens when the JSP page is turned into
a servlet. The file you specify is included as is into the JSP page before the
whole thing is turned into a servlet.
But with the include action (<jsp:include ... />) you can specify the file
name dynamically, because this include happens when the JSP page is called
to process a request. The JSP page (or servlet) specified by the include action
is executed and the response it produces is inserted into the response of
the main JSP page. You say it "includes the source as is without processing
the file." If that's the case, it's a bug in JRun so please report it to
Allaire.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
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