<jsp:include> :- It is used to include another JSP page into main jsp page.
a.jsp
............................
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>A</h1>
<jsp:include page="b.jsp"></jsp:include>
</body>
</html>
b.jsp
....................................................................................................................
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>B!</h1>
</body>
</html>
...........................................................................................................................................................
<jsp: forward>: It is used to forward one JSP page to another from the web server hence URL will not change and the content of the second web page will appear.
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>A</h1>
<jsp:forward page="b.jsp"></jsp:forward>
</body>
</html>
b.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>B!</h1>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>A</h1>
<jsp:forward page="b.jsp"></jsp:forward>
</body>
</html>
b.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>B!</h1>
</body>
</html>
POST Answer of Questions and ASK to Doubt