Page: 1
Unit-1: The Servlet Technology Model
Objectives - For each of the HTTP Methods (such as GET, POST, HEAD, and so on) describe the purpose of the method and the technical characteristics of the HTTP Method protocol, list triggers that might cause a Client (usually a Web browser) to use the method; and identify the HttpServlet method that corresponds to the HTTP Method.
- Using the HttpServletRequest interface, write code to retrieve HTML form parameters from the request, retrieve HTTP request header information, or retrieve cookies from the request.
- Using the HttpServletResponse interface, write code to set an HTTP response header, set the content type of the response, acquire a text stream for the response, acquire a binary stream for the response, redirect an HTTP request to another URL, or add cookies to the response.
- Describe the purpose and event sequence of the servlet life cycle: (1) servlet class loading, (2) servlet instantiation, (3) call the init method, (4) call the service method, and (5) call destroy method.
Q1. You are creating a web form with this HTML: 11. <form action="sendOrder.jsp"> 12. <input type="text" name="creditCard"> 13. <input type="text" name="expirationDate"> 14. <input type="submit"> 15. </form> Which HTTP method is used when sending this request from the browser? A. GET B. PUT C. POST D. SEND E. FORM Q2. Given a header in an HTTP request: X-Retries: 4Which two retrieve the value of the header from a given HttpServletRequest request? (Choose two.) A. request.getHeader("X-Retries") B. request.getIntHeader("X-Retries") C. request.getRequestHeader("X-Retries") D. request.getHeaders("X-Retries").get(0) E. request.getRequestHeaders("X-Retries").get(0) Q3. For a given ServletResponse response, which two retrieve an object for writing text data? (Choose two.) A. response.getWriter() B. response.getOutputStream() C. response.getOutputWriter() D. response.getWriter().getOutputStream() E. response.getWriter(Writer.OUTPUT_TEXT)
Get Answers For All Questions
Page: 1
1
2
3
4
5
6
7
8
9
|