

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the function of <jsp:include> action in JSP?
This action lets you insert files into the page being generated. The syntax looks like this −
<jsp:include page = "relative URL" flush = "true" />
Unlike the include directive, which inserts the file at the time the JSP page is translated into a servlet, this action inserts the file at the time the page is requested.
Following table lists out the attributes associated with the include action −
S.No. | Attribute & Description |
---|---|
1 | page The relative URL of the page to be included. |
2 | flush The boolean attribute determines whether the included resource has its buffer flushed before it is included. |
Example
Let us define the following two files (a)date.jsp and (b) main.jsp as follows −
Following is the content of the date.jsp file −
<p>Today's date: <%= (new java.util.Date()).toLocaleString()%></p>
Following is the content of the main.jsp file −
<html> <head> <title>The include Action Example</title> </head> <body> <center> <h2>The include action Example</h2> <jsp:include page = "date.jsp" flush = "true" /> </center> </body> </html>
Let us now keep all these files in the root directory and try to access main.jsp. You will receive the following output −
The include action Example
Today's date: 12-Sep-2010 14:54:22
- Related Questions & Answers
- What is the difference between include action and include directive in JSP?
- What is a include directive in JSP?
- What is the use of jsp plugin action element?
- What is the use of jsp text action element?
- What are the different scope values for the JSP action in JSP?
- What is the use of <jsp:text> Action in JSP?
- What is the session Object in JSP?
- Please share a running example of include directive in JSP
- What is JSP page redirection?
- What is the purpose of taglib directive in JSP?
- What is Java Server Pages, JSP? Why JSP is preferred over CGI?
- What is autoFlush attribute in JSP?
- What is contentType attribute in JSP?
- What is errorPage attribute in JSP?
- What is isErrorPage attribute in JSP?
Advertisements