Include tag in jsp

Include tag  :

Include action tag allows us to include a static or dynamic pages like html or jsp, specified by url during request processing. If page are static then its content is included in the calling jsp page. If requested page are dynamic then its output will be included on calling jsp. When requested page is dynamic then we can use <jsp:param> tag to pass name/value parameter in calling jsp.

Syntax :

<jsp:include attribute>

<!-- one or more <jsp:param> tag   -->


<jsp:include> action tag has “page” and “flush” attribute, which used to accept values for the specified jsp page.

page : It takes a relative url, which locate requested page. Here we can include relative url directly or in an expression within page attribute.

Note : Relative url can’t contain protocol, port, or domain name and starts with “/” character that specifying the url is taken relative to context path.

Example :

<jsp:include page=”/myhtml.html”/></pre>
<jsp:include page=”<%=mypath%>”/>

flush : It indicate the buffer needs to flushed or not before including the page and takes true or false values. If value is true, the buffer is flushed and its false by default.