Forums Register Login

Mock question

+Pie Number of slices to send: Send
Consider the following servlet code:
//...
public void service (HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
//1
}
Which of the following can be used at //1 to retrieve a JavaBean named
address present in the application scope? (Select one)
a getServletContext().getAttribute("address");
b application.getAttribute("address");
c request.getAttribute("address",APPLICATION_SCOPE);
d pageContext.getAttribute("address",APPLICATION_SCOPE);
+Pie Number of slices to send: Send
Hi,

The correct answer is a.

Best regards ...
+Pie Number of slices to send: Send
Thanks for reply.

What's wrong with choice d?
+Pie Number of slices to send: Send
Hi,

Choice d is using of of the implicit objects of the _jspService method in the Servlet generated by a JSP.

Regards ...
+Pie Number of slices to send: Send
Thanks.

Another question:
in the _jspService() method, the only visible objects are : request/response/out, correct?
+Pie Number of slices to send: Send
Hi,

They are :

JspWriter out
HttpServletRequest request
HttpServletResponse response
HttpSession session
ServletContext application
ServletConfig config
JspException exception
PageContext pageContext
Object page

Best of luck ...
I found some pretty shells, some sea glass and this lovely tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1207 times.
Similar Threads
Getting Portlet session.
Http Session and PortletSession?
content model question
HOw to get session variables between portlets ?
How to pass session data between 2 Portlets???
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:55:14.