VOOZH about

URL: https://www.geeksforgeeks.org/advance-java/jsp-include-action-tag/

⇱ JSP - Include Action Tag - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JSP - Include Action Tag

Last Updated : 14 May, 2026

The Include Action Tag in JSP is used to include the content of one JSP page into another at request time. It helps in reusing common components like headers and footers, making web applications more modular and maintainable. This inclusion happens dynamically when the page is requested.

  • Uses <jsp:include> tag to include another JSP page
  • Content is included at request time (dynamic)
  • Helps in code reusability and modular design

Syntax:

<jsp:include page="file.jsp" />

Implementation of Include action tag in JSP

A simple JSP application that will demonstrate the Include Action Tag of JSP.

Step 1: Create index.jsp

This is the main page where we include header and footer using <jsp:include>.

index.jsp:

Step 2: Create header.jsp

This file contains reusable header content.

header.jsp:

Step 3: Create footer.jsp

This file contains reusable footer content.

footer.jsp:

Step 4: Run the Application

  • Right-click project -> Run As -> Run on Server
  • Select Apache Tomcat

Url: http://localhost:8080/YourProject/

Output:

  • When the user opens index.jsp, the message “Welcome to the Include Example” is displayed
  • The <jsp:include> tag dynamically includes header.jsp and footer.jsp
  • Final output shows combined content (header + main content + footer)

👁 Output Screen

Comment
Article Tags:

Explore