Vcehome > Oracle > Others Oracle Certifications > 1Z0-858 > 1Z0-858 Online Practice Questions and Answers

1Z0-858 Online Practice Questions and Answers

Questions 4

Given the JSP code:

<% request.setAttribute("foo", "bar"); %> and the Classic tag handler code:

5.

public int doStartTag() throws JspException {

6.

// insert code here

7.

// return int

8.

}

Assume there are no other "foo" attributes in the web application.

Which invocation on the pageContext object, inserted at line 6, assigns "bar" to the variable x?

A. String x = (String) pageContext.getAttribute("foo");

B. String x = (String) pageContext.getRequestScope("foo");

C. It is NOT possible to access the pageContext object from within doStartTag.

D. String x = (String)pageContext.getRequest().getAttribute("foo");

E. String x = (String) pageContext.getAttribute("foo",PageContext.ANY_SCOPE);

Browse 276 Q&As
Questions 5

A developer for the company web site has been told that users may turn off cookie support in their browsers. What must the developer do to ensure that these customers can still use the web application?

A. The developer must ensure that every URL is properly encoded using the appropriate URL rewriting APIs.

B. The developer must provide an alternate mechanism for managing sessions and abandon the HttpSession mechanism entirely.

C. The developer can ignore this issue. Web containers are required to support automatic URL rewriting when cookies are not supported.

D. The developer must add the string id= to the end of every URL to ensure that the conversation with the browser can continue.

Browse 276 Q&As
Questions 6

Your web application requires the adding and deleting of many session attributes during a complex use case. A bug report has come in that indicates that an important session attribute is being deleted too soon and a NullPointerException is being thrown several interactions after the fact. You have decided to create a session event listener that will log when attributes are being deleted so you can track down when the attribute is erroneously being deleted.

Which listener class will accomplish this debugging goal?

A. Create an HttpSessionAttributeListener class and implement the attributeDeleted method and log the attribute name using the getName method on the event object.

B. Create an HttpSessionAttributeListener class and implement the attributeRemoved method and log the attribute name using the getName method on the event object.

C. Create an SessionAttributeListener class and implement the attributeRemoved method and log the attribute name using the getAttributeName method on the event object.

D. Create an SessionAttributeListener class and implement the attributeDeleted method and log the attribute name using the getAttributeName method on the event object.

Browse 276 Q&As
Questions 7

You are creating a web form with this HTML:

11.

12.

13.

14.

15.

Which HTTP method is used when sending this request from the browser?

A. GET

B. PUT

C. POST

D. SEND

E. FORM

Browse 276 Q&As
Questions 8

A developer is designing the presentation tier for a web application which requires a centralized request handling to complete common processing required by each request. Which design pattern provides a solution to this problem?

A. Remote Proxy

B. Front Controller

C. Service Activator

D. Intercepting Filter

E. Business Delegate

F. Data Access Object

Browse 276 Q&As
Questions 9

A JSP page needs to instantiate a JavaBean to be used by only that page. Which two jsp:useBean attributes must be used to access this attribute in the JSP page? (Choose two.)

A. id

B. type

C. name

D. class

E. scope

F. create

Browse 276 Q&As
Questions 10

You are creating an error page that provides a user-friendly screen whenever a server exception occurs. You want to hide the stack trace, but you do want to provide the exception's error message to the user so the user can provide it to the customer service agent at your company. Which EL code snippet inserts this error message into the error page?

A. Message: ${exception.message}

B. Message: ${exception.errorMessage}

C. Message: ${request.exception.message}

D. Message: ${pageContext.exception.message}

E. Message: ${request.exception.errorMessage}

F. Message: ${pageContext.exception.errorMessage}

Browse 276 Q&As
Questions 11

A web component accesses a local EJB session bean with a component interface of com.example.Account with a home interface of com.example.AccountHome and a JNDI reference of ejb/ Account. Which makes the local EJB component accessible to the web components in the web application deployment descriptor?

A. ejb/AccountSessioncom.example.AccountHomecom.example.Account

B. ejb/AccountSessioncom.example.AccountHomecom.example.Account

C. ejb/AccountSessioncom.example.AccountHomecom.example.Account

D. ejb/AccountSessioncom.example.AccountHomecom.example.Account

Browse 276 Q&As
Questions 12

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"); %>

Browse 276 Q&As
Questions 13

You are creating a servlet that generates stock market graphs. You want to provide the web browser with precise information about the amount of data being sent in the response stream. Which two HttpServletResponse methods will you use to provide this information? (Choose two.)

A. response.setLength(numberOfBytes);

B. response.setContentLength(numberOfBytes);

C. response.setHeader("Length", numberOfBytes);

D. response.setIntHeader("Length", numberOfBytes);

E. response.setHeader("Content-Length", numberOfBytes);

F. response.setIntHeader("Content-Length", numberOfBytes);

Browse 276 Q&As
Exam Code: 1Z0-858
Exam Name: Java Enterprise Edition 5 Web Component Developer Certified Professional Exam
Last Update: May 10, 2024
Questions: 276 Q&As

PDF

$49.99

VCE

$59.99

PDF + VCE

$67.99