JSP Tutorials

JSP Include action tag
Previous Home Next
adplus-dvertising

jsp:include action tag

In jsp:include action tag can be include the content of another resource it may be jsp, html or servlet.

It can be includes the resource at request time make a dynamic pages and also make include static pages.

Advantage

Code reusability : In this tag is use a page many times such as including header and footer pages in all pages with saves a lot of time.

Syntax of jsp:include action tag with parameter

<jsp:include page="relativeURL | <%= expression %>">  
    <jsp:param name="parametername" value="parametervalue | <%=expression%>" />  
    </jsp:include>  

    <jsp:include page="relativeURL | <%= expression %>">  
    <jsp:param name="parametername" value="parametervalue | <%=expression%>" />  
    </jsp:include>
index.html
    <h2>this is index page</h2>  
    <jsp:include page="printdate.jsp" />  
    <h2>end section of index page</h2>
    <h2>this is index page</h2>  
    <jsp:include page="printdate.jsp" />  
    <h2>end section of index page</h2>
printdate.jsp
    <% out.print("Today is:"+java.util.Calendar.getInstance().getTime()); %>  

    <% out.print("Today is:"+java.util.Calendar.getInstance().getTime()); %>  

Previous Home Next