Skip to main content

1Z0-858 Real Exam Questions

Java Enterprise Edition 5 Web Component Developer Certified Professional

276 questions available · Page 1 of 28

Updated Exam DumpsVerified AnswersPass Guarantee

Get Complete Exam Dumps
Question 1 Multiple choice

Which two are characteristics of the Intercepting Filter pattern? (Choose two.)

  1. A

    It provides centralized request handling for incoming requests.

  2. B

    It forces resource authentication to be distributed across web components.

  3. C

    It reduces coupling between presentation-tier clients and underlying business services.

  4. D

    It can be added and removed unobtrusively, without requiring changes to existing code.

  5. E

    It allows preprocessing and postprocessing on the incoming requests and outgoing responses.

Show answer and explanation

Correct answers: D, E

Question 2 Single choice

Given:
5. public class MyTagHandler extends TagSupport {
6. public int doStartTag() throws JspException {
7. try {
8. // insert code here
9. } catch(Exception ex) { /* handle exception */ }
10. return super.doStartTag();
11. }
...
42. }

Which code snippet, inserted at line 8, causes the value foo to be output?

  1. A

    JspWriter w = pageContext.getOut();

  2. B

    print("foo");

  3. C

    JspWriter w = pageContext.getWriter();

    100% Real Q&As | 100% Real Pass

  4. D

    print("foo");

  5. E

    JspWriter w = new JspWriter(pageContext.getWriter());

  6. F

    print("foo");

  7. G

    JspWriter w = new JspWriter(pageContext.getResponse());

  8. H

    print("foo");

Show answer and explanation

Correct answer: A

Question 3 Single choice

In your web application, you need to execute a block of code whenever the session object is first created.

Which design will accomplish this goal?

  1. A

    Create an HttpSessionListener class and implement the sessionInitialized method with that block of

    code.

  2. B

    Create an HttpSessionActivationListener class and implement the sessionCreated method with that

    block of code.

  3. C

    Create a Filter class, call the getSession(false) method, and if the result was null, then execute that

    block of code.

  4. D

    Create an HttpSessionListener class and implement the sessionCreated method with that block of

    code.

  5. E

    Create a Filter class, call the getSession(true) method, and if the result was NOT null, then execute

    that block of code.

Show answer and explanation

Correct answer: D

Question 4 Multiple choice

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.)

  1. A

    id

  2. B

    type

  3. C

    name

  4. D

    class

  5. E

    scope

  6. F

    create

Show answer and explanation

Correct answers: A, D

Question 5 Single choice

Given a web application in which the cookie userName is expected to contain the name of the user.

Which EL expression evaluates to that user name?

  1. A

    ${userName}

  2. B

    ${cookie.userName}

  3. C

    ${cookie.user.name}

  4. D

    ${cookies.userName[0]}

  5. E

    ${cookies.userName}[1]

  6. F

    ${cookies.get('userName')}

    100% Real Q&As | 100% Real Pass

Show answer and explanation

Correct answer: B

Question 6 Single choice

You have built a web application with tight security. Several directories of your webapp are used for internal purposes and you have overridden the default servlet to send an HTTP 403 status code for any request that maps to one of these directories. During testing, the Quality Assurance director decided that they did NOT like seeing the bare response page generated by Firefox and Internet Explorer. The director recommended that the webapp should return a more user-friendly web page that has the same look-and-feel as the webapp plus links to the webapp's search engine. You have created this JSP page in the / WEB-INF/jsps/error403.jsp file. You do NOT want to alter the complex logic of the default servlet.

How can you declare that the web container must send this JSP page whenever a 403 status is generated?

  1. A

    <error-page><error-code>403</error-code><url>/WEB-INF/jsps/error403.jsp</url></error-page>

  2. B

    <error-page><status-code>403</status-code><url>/WEB-INF/jsps/error403.jsp</url></error-page>

  3. C

    <error-page><error-code>403</error-code><location>/WEB-INF/jsps/error403.jsp</location></error-

    page>

  4. D

    <error-page><status-code>403</status-code><location>/WEB-INF/jsps/error403.jsp</location></

    error-page>

Show answer and explanation

Correct answer: C

Question 7 Single choice

Click the Exhibit button.

The attribute "name" has a value of "Foo,"

What is the result if this tag handler's tag is invoked?

100% Real Q&As | 100% Real Pass

  1. A

    Foo

  2. B

    done

  3. C

    Foodone

  4. D

    An exception is thrown at runtime.

  5. E

    No output is produced from this code.

  6. F

    Compilation fails because of an error in this code.

Show answer and explanation

Correct answer: A

Question 8 Single choice

After a merger with another small business, your company has inherited a legacy WAR file but the original source files were lost. After reading the documentation of that web application, you discover that the WAR file contains a useful tag library that you want to reuse in your own webapp packaged as a WAR file.

What do you need to do to reuse this tag library?

  1. A

    Simply rename the legacy WAR file as a JAR file and place it in your webapp's library directory.

  2. B

    Unpack the legacy WAR file, move the TLD file to the META-INF directory, repackage the whole thing

    as a JAR file, and place that JAR file in your webapp's library directory.

  3. C

    Unpack the legacy WAR file, move the TLD file to the META-INF directory, move the class files to the

    top-level directory, repackage the whole thing as a JAR file, and place that JAR file in your webapp's library directory.

  4. D

    Unpack the legacy WAR file, move the TLD file to the META-INF directory, move the class files to the

    top-level directory, repackage the WAR, and place that WAR file in your webapp's WEB-INF directory.

Show answer and explanation

Correct answer: C

Question 9 Single choice

To take advantage of the capabilities of modern browsers that use web standards, such as XHTML and CSS, your web application is being converted from simple JSP pages to JSP Document format. However, one of your JSPs, /scripts/screenFunctions.jsp, generates a JavaScript file. This file is included in several web forms to create screen-specific validation functions and are included in these pages with the following statement:

10. <head>
11. <script src='/scripts/screenFunctions.jsp'
12. language='javascript'
13. type='application/javascript'> </script>
14. </head>
15. <!-- body of the web form -->

Which JSP code snippet declares that this JSP Document is a JavaScript file?

  1. A

    <%@ page contentType='application/javascript' %>

  2. B

    <jsp:page contentType='application/javascript' />

  3. C

    <jsp:document contentType='application/javascript' />

  4. D

    <jsp:directive.page contentType='application/javascript' />

  5. E

    No declaration is needed because the web form XHTML page already declares the MIME type of the /

    scripts/screenFunctions.jsp file in the <script> tag.

Show answer and explanation

Correct answer: D

Question 10 Single choice

Which method must be used to encode a URL passed as an argument to HttpServletResponse.sendRedirect when using URL rewriting for session tracking?

  1. A

    ServletResponse.encodeURL

  2. B

    HttpServletResponse.encodeURL

  3. C

    ServletResponse.encodeRedirectURL

  4. D

    HttpServletResponse.encodeRedirectURL

Show answer and explanation

Correct answer: D