Given that a web application consists of two HttpServlet classes, ServletA and ServletB, and the ServletA.service method:
20.
String key = "com.example.data";
21.
session.setAttribute(key, "Hello");
22.
Object value = session.getAttribute(key);
23.
Assume session is an HttpSession, and is not referenced anywhere else in ServletA.
Which two changes, taken together, ensure that value is equal to "Hello" on line 23? (Choose two.)
A. ensure that the ServletB.service method is synchronized
B. ensure that the ServletA.service method is synchronized
C. ensure that ServletB synchronizes on the session object when setting session attributes
D. enclose lines 21-22 in a synchronized block:synchronized(this) {session.setAttribute(key, "Hello");value = session.getAttribute(key);}
E. enclose lines 21-22 in a synchronized block:synchronized(session) {session.setAttribute(key, "Hello");value = session.getAttribute(key);}
Which retrieves all cookies sent in a given HttpServletRequest request?
A. request.getCookies()
B. request.getAttributes()
C. request.getSession().getCookies()
D. request.getSession().getAttributes()
Your company has a corporate policy that prohibits storing a customer's credit card number in any corporate database. However, users have complained that they do NOT want to re-enter their credit card number for each transaction. Your management has decided to use client-side cookies to record the user's credit card number for 120 days. Furthermore, they also want to protect this information during transit from the web browser to the web container; so the cookie must only be transmitted over HTTPS. Which code snippet creates the "creditCard" cookie and adds it to the out going response to be stored on the user's web browser?
A. 10. Cookie c = new Cookie("creditCard", usersCard);11. c.setSecure(true);12.
B. setAge(10368000);13. response.addCookie(c);
C. 10. Cookie c = new Cookie("creditCard", usersCard);11. c.setHttps(true);12.
D. setMaxAge(10368000);13. response.setCookie(c);
E. 10. Cookie c = new Cookie("creditCard", usersCard);11. c.setSecure(true);12.
F. setMaxAge(10368000);13. response.addCookie(c);
G. 10. Cookie c = new Cookie("creditCard", usersCard);11. c.setHttps(true);12.
H. setAge(10368000);13. response.addCookie(c);
I. 10. Cookie c = new Cookie("creditCard", usersCard);11. c.setSecure(true);12.
J. setAge(10368000);13. response.setCookie(c);
A web browser need NOT always perform a complete request for a particular page that it suspects might NOT have changed. The HTTP specification provides a mechanism for the browser to retrieve only a partial response from the web server; this response includes information, such as the Last- Modified date but NOT the body of the page. Which HTTP method will the browser use to retrieve such a partial response?
A. GET
B. ASK
C. SEND
D. HEAD
E. TRACE
F. OPTIONS
Which ensures that a JSP response is of type "text/plain"?
A. <%@ page mimeType="text/plain" %>
B. <%@ page contentType="text/plain" %>
C. <%@ page pageEncoding="text/plain" %>
D. <%@ page contentEncoding="text/plain" %>
E. <% response.setEncoding("text/plain"); %>
F. <% response.setMimeType("text/plain"); %>
Your web application uses a simple architecture in which servlets handle requests and then forward to a JSP using a request dispatcher. You need to pass information calculated in the servlet to the JSP for view generation. This information must NOT be accessible to any other servlet, JSP or session in the webapp. Which two techniques can you use to accomplish this goal? (Choose two.)
A. Add attributes to the session object.
B. Add attributes on the request object.
C. Add parameters to the request object.
D. Use the pageContext object to add request attributes.
E. Add parameters to the JSP's URL when generating the request dispatcher.
All of your JSPs need to have a link that permits users to email the web master. This web application is licensed to many small businesses, each of which have a different email address for the web master. You have decided to use a context parameter that you specify in the deployment descriptor, like this:
42.
43.
44.
45.
Which JSP code snippet creates this email link?
A. contact us
B. contact us
C. contact us
D. contact us
In a JSP-centric web application, you need to create a catalog browsing JSP page. The catalog is stored as a List object in the catalog attribute of the webapp's ServletContext object. Which scriptlet code snippet gives you access to the catalog object?
A. <% List catalog = config.getAttribute("catalog"); %>
B. <% List catalog = context.getAttribute("catalog"); %>
C. <% List catalog = application.getAttribute("catalog"); %>
D. <% List catalog = servletContext.getAttribute("catalog"); %>
You are building your own layout mechanism by including dynamic content for the page's header and footer sections. The footer is always static, but the header generates the
A.
B.
C.
D.
Which is a benefit of precompiling a JSP page?
A. It avoids initialization on the first request.
B. It provides the ability to debug runtime errors in the application.
C. It provides better performance on the first request for the JSP page.
D. It avoids execution of the _jspService method on the first request.
Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Oracle exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your 1Z0-858 exam preparations and Oracle certification application, do not hesitate to visit our Vcedump.com to find your solutions here.