The implicit JSP objects like request, response, and out are only visible in the _jspService() method. Answer: (A) Unless passed in as arguments to other methods, the implicit JSP arguments are only visible in the jspService() method. See JSP Implicit Objects. How can a servlet call a JSP error page? A. This capability is not supported. B. When the servlet throws the exception, it will automatically be caught by the calling JSP page. C. The servlet needs to forward the request to the specific error page URL. The exception is passed along as an attribute named "javax.servlet.jsp.jspException". D. The servlet needs to redirect the response to the specific error page, saving the exception off in a cookie. Answer (C): D will get the browser to display the appropriate page, it just doesn't preserve the state information requiring an unnecessary round trip to the browser. C is the direct approach. See Exception Handling and the jGuru JSP FAQ.
Sun’s ePractice: Given this text from a valid web.xml file for a web application to be deployed at www.myorg.org: <servlet> <servletname>shopping <servletclass>org.myorg.ShoppingServlet <paramname>year <paramvalue>2004 <servletmapping> <servletname>shopping /shop/*
Which is true?
A
Requests for the URL http://www.myorg.org/shopping will be sent to the org.myorg.ShoppingServlet servlet.
B
It would be invalid to add another <servlet> element that also included <servletname>shopping.
C
Each time the servlet named "shopping" is used to process a request, it will be passed a parameter named "year" with a value of "2004."
D
It would be invalid to add another <servletmapping> element that also included <servletname>shopping.
E
The <servletmapping> element should be nested within the <servlet> element.