Example & Tutorial understanding programming in easy ways.

In JSPs how many ways are possible to perform inclusion?

 We can perform inclusion In JSP, in the following ways.

 

By include directive:

<%@ include file=”header.jsp” %>

The content of the header.jsp will be included in the current jsp at translation time. Hence this inclusion is also known as static include.

By include action:

<jsp:include page=”header.jsp” />

The response of the jsp will be included in the current page response at request processing time(run time) hence it is also known as dynamic include.

by using pageContext implicit object

<%

pageContext.include(“/header.jsp”);

%>

This inclusion also happened at request processing time(run time).

by using RequestDispatcher object

<%

RequestDispatcher rd = request.getRequestDispatcher(“/header.jsp”);

Rd.incliude(request,response);

%>

Read More →