How do I include a file in a JSP page?

Alessandro A. Garbagnati

Jon Oskar,
Yes, there are two different ways to do that:
The first one is done using the 'include' directive:

<%@ include file="relativeURL" %>
In this case the given page will be statically included inside the the jsp page.

The second include is done using the jsp tag 'include':
<jsp:include page="{relativeURL | <%= expression %>}" flush="true" />
With this syntax, the page will be included statically or dinamically, depending on the page itself.
If the page to be included is dynamic, parameters can be passed to it using this syntax:
<jsp:include page="{relativeURL | <%= expression %>}" flush="true" >
      <jsp:param name="parameterName" 
		value="{parameterValue | <%= expression %>}" /> 

Note: with Jsp 1.1 the "flush" parameter can only be true.

[See also http://www.jguru.com/faq/view.jsp?EID=13517 -Alex]