Assuming that a JSP by name "one.jsp" wants to have a request time inclusion
to happen for the page "two.jsp". Choose the following right operations (assuming
that the following code is residing in "one.jsp"?
b. <jsp:include page = "two.jsp" />
c. <@% include file "two.jsp" %>
d. request.getRequestDispatcher("two.jsp").include(request, response)
e. All the above.
calling include method of the PageContext has the same effect -as the answerd indicate- as calling the include method of the RequestDispatcher or using the jsp:include action. From the API
Causes the resource specified to be processed as part of the current ServletRequest and ServletResponse being processed by the calling Thread. The output of the target resources processing of the request is written directly to the ServletResponse output stream.
The current JspWriter "out" for this JSP is flushed as a side-effect of this call, prior to processing the include.
If the relativeUrlPath begins with a "/" then the URL specified is calculated relative to the DOCROOT of the ServletContext for this JSP. If the path does not begin with a "/" then the URL specified is calculated relative to the URL of the request that was mapped to the calling JSP.
And pageContext is a implicit object available in a JSP.
Correct me if I'm wrong.
By the way, you can check this by setting In this case content included with RequestDispatcher will appear in the right place, because all otput from jsp will be automatically flushed to the actual response strean.