Which method takes the HttpServletRequest and HttpServletResponse objects as its arguments
-
jspInit()
-
jspDestroy()
-
_jspService()
-
None of the above
In JSP, the _jspService() method is automatically generated by the container and is responsible for handling HTTP requests. It receives HttpServletRequest and HttpServletResponse objects as parameters, similar to the service() method in servlets. jspInit() is for initialization (no parameters), jspDestroy() is for cleanup (no parameters). Therefore, _jspService() is the correct answer.
The _jspService() method is the one that takes the HttpServletRequest and HttpServletResponse objects as its arguments — it's the method the JSP container generates and calls on every request to execute the JSP's logic and produce output, analogous to a servlet's service() method. jspInit() and jspDestroy() are lifecycle methods called once when the JSP is loaded/unloaded and take no request/response parameters, since they aren't tied to a specific request.