The <%@ include %> directive is processed at JSP load time, reading in the
contents of the target file and dropping it inline into the body of the JSP.
(You can't specify this file name dynamically because this would effectively
change the source code of the JSP file, requiring recompilation.)

The <jsp:include/> tag, on the other hand, reads the processed results of
the target URI (i.e. as if you'd requested it from a browser - after
executing any server-side code).  You can specify it dynamically:

<jsp:include file="<%= myURIString >" flush="true" />

The results of this request are inserted into the output of the JSP doing
the include (as opposed to the source code of the JSP doing the include).
For this reason, it's feasible to <jsp:include/> all manner of strange
resources, such as CGI scripts.

Michael

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of David Reck
Sent: Wednesday, August 30, 2000 12:09 AM
To: [EMAIL PROTECTED]
Subject: Using the include file tag


Does anyone know how to use the <%@ include file="" %> tag with a variable
as
the file name.  I need to be able to select the file to include at runtime
and I
thought assigning a variable to the file name would be the easiest way.

Thanks,

Dave

*******************Internet Email Confidentiality Footer*******************


Privileged/Confidential Information may be contained in this message.  If
you
are not the addressee indicated in this message (or responsible for delivery
of
the message to such person), you may not copy or deliver this message to
anyone.
In such case, you should destroy this message and kindly notify the sender
by
reply email. Please advise immediately if you or your employer do not
consent to
Internet email for messages of this kind.  Opinions, conclusions and other
information in this message that do not relate to the official business of
my
firm shall be understood as neither given nor endorsed by it.

===========================================================================
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