GATE | GATE-IT-2004 | Question 29
Which of the following objects can be used in expressions and scriplets in JSP (Java Server Pages) without explicitly declaring them?
(A) session and request only
(B) request and response only
(C) response and session only
(D) session, request and response
JSP provides certain implicit objects which are accessed using standard variables and are automatically available for use in our JSP without writing any extra code. We can directly use them within Scriptlet without initializing and declaring them.
Request : It encapsulates the request coming from the Client and being processed by the JSP. It is passed to the JSP by the container as a parameter of the jspService( ) method.
Session : Session are created automatically, and a new session is available even when there is no incoming session unless we have used a session = ”false” attribute in the page directive.
Response : It is used to reply to the client(browser) with either some data or redirect to some other page
Thus, option (D) is correct.
Please comment below if you find anything wrong in the above post.
Quiz of this Question