Set - 3

Question 11 :

What is the difference between ServletContext and PageContext?

Answer :

ServletContext: Gives the information about the container
PageContext: Gives the information about the Request


Question 12 :

What is the difference in using request.getRequestDispatcher() and context.getRequestDispatcher()?

Answer :

request.getRequestDispatcher(path): In order to create it we need to give the relative path of the resource context.getRequestDispatcher(path): In order to create it we need to give the absolute path of the resource.


Question 13 :

How to pass information from JSP to included JSP?

Answer :

Using <%jsp:param> tag.


Question 14 :

How is JSP include directive different from JSP include action. ?

Answer :

When a JSP include directive is used, the included file's code is added into the added JSP page at page translation time, this happens before the JSP page is translated into a servlet. While if any page is included using action tag, the page's output is returned back to the added page. This happens at runtime.


Question 15 :

Can we override the jspInit(), _jspService() and jspDestroy() methods?

Answer :

We can override jspinit() and jspDestroy() methods but not _jspService().