jsp:include standard action Tag

This action is used to a static or dynamic resources specify by URL in the current JSP page at the request processing time. An included page has access only to the JspWriter object, and it cannot set header or cookies.
Syntax of <jsp:include> action tag
<jsp:include page="URL" flush="true " / >
or
<jsp:include page="URL" flush="true" > <jsp:param name="param name" value="param value" />

....
</jsp:include>

Attribute of <jsp:include>
  1. page :- This resource to include the URL format.
  2. fulsh : This attribute is optional, by default it's value is false.
Example of <jsp:include> action tag
index.jsp
<%@ page language="java" import="java.util.*" %> <html> <head> <title>jsp:include action tag example </title> </head> <body> <h1> jsp:include action tag example </h1> <h2> Display Current Date & Time </h2> <br> <jsp:include page="displayDate.jsp" /> </body> </html>
displayDate.jsp
<%@ page language="java" import="java.util.*" %> <html> <head> <title>Display current date and time </title> </head> <body> <b>Current Date and Time :</b> <%=new Date().toLocaleString() %> </body> </html>
Output
jsp:include
Download this example
 



 

Latest Tutorial


Most Visited Tutorial