JSP Include Example
JSP Include Example explains step by step details of dynamically including a jsp page
Consider an example where we are including a page (welcome.jsp) inside include.jsp.
The jsp:include Tag
You can see the below example, which is demonstrating How to include JSP pages dynamically
include.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>jsp:include example</title> </head> <body> This is a page<br/> <jsp:include page="welcome.jsp" /> </body> </html>
welcome.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Welcome</title> </head> <body> Welcome Dynamic Include Is Working Now </body> </html>