> When we talk in terms of file include or <jsp:include >, the only
> difference comes up is, file include will contain the code at the
> compile time, whereas <jsp:include> use servlet chaining to use that code.

I'd say thats a great deal of differense, especially in this case.

If you use the include directive, <%@ include file="included.jsp" %>, you
get COMPILE TIME include. The SOURCE CODE of the included JSP is inserted
where the directive is. If you have methods, (scriptlet) variables, bean etc
declared on the included page you can use them on the including page.

If you use the include action, <jsp:include page="included.jsp" />, you get
RUNTIME include. At the place of the action, an internal request goes to the
included page and the OUTPUT of that page is inserted in the output.
Remember that the parameters of the request are available in the included
page also.

Try to compare the source of the servlets compiled from the JSPs. The one
with <%@ include %> contains the whole included file. The one with
<jsp:include /> contains one or a few extra lines.

Conclusion: If you have problems including lots of static output,
<jsp:include /> should do the trick.

Also, read Hans Bergstens tip #1 here:
http://java.oreilly.com/news/jsptips_1100.html

Mattias Jiderhamn
Expert Systems
[EMAIL PROTECTED]

===========================================================================
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to