In which scenario, Container initializes multiple JSP/Servlet objects?

To initialize multiple JSP objects, we have to specify same Servlet object multiple times in web.xml. This indicates to JSP

How will you prevent caching of HTML output by web browser in JSP?

We can use set the header in response object for Cache-Control to specify no caching. Sample code is as follows:

How will you redirect request to another page in browser in JSP code?

We can use sendRedirect() method in JSP to redirect the request to another location or page. In this case the

What is the difference between sendRedirect and forward in a JSP?

Both forward and sendRedirect are mechanisms of sending a client to another page. The main difference between these two are

What is the use of config implicit object in JSP?

In JSP, config object is of type ServletConfig. This object is created by Servlet Container for each JSP page. It

What is the difference between init-param and context-param?

We can specify both init-param and context-param in web.xml file. We use init-param to specify the parameters that are specific

What is the purpose of RequestDispatcher?

We use RequestDispatcher interface to forward requests to other resources like HTML, JSP etc. It can also be used to