Java, .NET, PHP, PYTHON, ANGULAR, .NET, ML, Data Scince, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

JSP predefined Tag, Include Tag in JSP

<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.



<%@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>




Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post