Questions

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Questions as PDF for free.

More details

  • Words: 269
  • Pages: 2
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>     <servlet­name>shopping     <servlet­class>org.myorg.ShoppingServlet              <param­name>year         <param­value>2004      <servlet­mapping>     <servlet­name>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 <servlet­name>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 <servlet­mapping> element that also included <servlet­name>shopping.

E

The <servlet­mapping> element should be nested within the <servlet> element.

Related Documents

Questions
September 2019 34
Questions
October 2019 21
Questions
November 2019 17
Questions
April 2020 19
Questions
May 2020 6
Questions
October 2019 18