Javatpoint Logo

91-9990449935

 0120-4256464

jsp:include action tag

The jsp:include action tag is used to include the content of another resource it may be jsp, html or servlet.

The jsp include action tag includes the resource at request time so it is better for dynamic pages because there might be changes in future.

The jsp:include tag can be used to include static as well as dynamic pages.


Advantage of jsp:include action tag

Code reusability : We can use a page many times such as including header and footer pages in all pages. So it saves a lot of time.


Difference between jsp include directive and include action

JSP include directiveJSP include action
includes resource at translation time.includes resource at request time.
better for static pages.better for dynamic pages.
includes the original content in the generated servlet.calls the include method.

Syntax of jsp:include action tag without parameter

Syntax of jsp:include action tag with parameter


Example of jsp:include action tag without parameter

In this example, index.jsp file includes the content of the printdate.jsp file.

File: index.jsp
File: printdate.jsp
jsp include tag
Next TopicJava Bean