Exam2pass
0 items Sign In or Register
  • Home
  • IT Exams
  • Guarantee
  • FAQs
  • Reviews
  • Contact Us
  • Demo
Exam2pass > Oracle > Oracle Certifications > 1Z0-858 > 1Z0-858 Online Practice Questions and Answers

1Z0-858 Online Practice Questions and Answers

Questions 4

You are building a web application that will be used throughout the European Union; therefore, it has significant internationalization requirements. You have been tasked to create a custom tag that generates a message using the java.text.MessageFormat class. The tag will take the resourceKey attribute and a variable number of argument attributes with the format, arg. Here is an example use of this tag and its output:

generates:

The disk "MyDisk" contains 1247 file(s).

Which Simple tag class definition accomplishes this goal of handling a variable number of tag attributes?

A. public class MessageTag extends SimpleTagSupportimplements VariableAttributes {private Map attributes = new HashMap();public void setVariableAttribute(String uri,String name, Object value) {this.attributes.put(name, value);}// more tag handler methods}

B. The Simple tag model does NOT support a variable number of attributes.

C. public class MessageTag extends SimpleTagSupportimplements DynamicAttributes {private Map attributes = new HashMap();public void putAttribute(String name, Object value) {this.attributes.put (name, value);}// more tag handler methods}

D. public class MessageTag extends SimpleTagSupportimplements VariableAttributes {private Map attributes = new HashMap();public void putAttribute(String name, Object value) {this.attributes.put (name, value);}// more tag handler methods}

E. public class MessageTag extends SimpleTagSupportimplements DynamicAttributes {private Map attributes = new HashMap();public void setDynamicAttribute(String uri, String name,Object value) {this.attributes.put(name, value);}// more tag handler methods}

Buy Now

Correct Answer: E

Questions 5

Your web site has many user-customizable features, for example font and color preferences on web pages. Your IT department has already built a subsystem for user preferences using the Java SE platform's lang.util.prefs package APIs, and you have been ordered to reuse this subsystem in your web application. You need to create an event listener that constructs the preferences factory and stores it in the application scope for later use. Furthermore, this factory requires that the URL to a database must be declared in the deployment descriptor like this:

42.

43.

prefsDbURL

44.

45.

jdbc:pointbase:server://dbhost:4747/prefsDB

46.

47.

Which partial listener class will accomplish this goal?

A. public class PrefsFactoryInitializer implements ContextListener {public void contextInitialized (ServletContextEvent e) {ServletContext ctx = e.getContext();String prefsURL = ctx.getParameter ("prefsDbURL");PreferencesFactory myFactory = makeFactory(prefsURL);ctx.putAttribute ("myPrefsFactory", myFactory);}// more code here}

B. public class PrefsFactoryInitializer implements ServletContextListener {public void contextCreated (ServletContext ctx) {String prefsURL = ctx.getInitParameter("prefsDbURL");PreferencesFactory myFactory = makeFactory (prefsURL);ctx.setAttribute("myPrefsFactory", myFactory);}// more code here}

C. public class PrefsFactoryInitializer implements ServletContextListener {public void contextInitialized (ServletContextEvent e) {ServletContext ctx = e.getServletContext();String prefsURL = ctx.getInitParameter ("prefsDbURL");PreferencesFactory myFactory = makeFactory (prefsURL);ctx.setAttribute("myPrefsFactory", myFactory);}// more code here}

D. public class PrefsFactoryInitializer implements ContextListener {public void contextCreated (ServletContext ctx) {String prefsURL = ctx.getParameter("prefsDbURL");PreferencesFactory myFactory = makeFactory (prefsURL);ctx.putAttribute("myPrefsFactory", myFactory);}// more code here}

Buy Now

Correct Answer: C

Questions 6

Which three are true about the HttpServletRequestWrapper class? (Choose three.)

A. The HttpServletRequestWrapper is an example of the Decorator pattern.

B. The HttpServletRequestWrapper can be used to extend the functionality of a servlet request.

C. A subclass of HttpServletRequestWrapper CANNOT modify the behavior of the getReader method.

D. An HttpServletRequestWrapper may be used only by a class implementing the javax.servlet.Filter interface.

E. An HttpServletRequestWrapper CANNOT be used on the request passed to the RequestDispatcher.include method.

F. An HttpServletRequestWrapper may modify the header of a request within an object implementing the javax.servlet.Filter interface.

Buy Now

Correct Answer: ABF

Questions 7

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

A. ServletResponse.encodeURL

B. HttpServletResponse.encodeURL

C. ServletResponse.encodeRedirectURL

D. HttpServletResponse.encodeRedirectURL

Buy Now

Correct Answer: D

Questions 8

Your web application views all have the same header, which includes the tag in the <head> element of the rendered HTML. You have decided to remove this redundant HTML code from your JSPs and put it into a single JSP called / WEB-INF/jsp/header.jsp. However, the title of each page is unique, so you have decided to use a variable called pageTitle to parameterize this in the header JSP, like this: </p><p>10. <title>${param.pageTitle}<title> </p><p>Which JSP code snippet should you use in your main view JSPs to insert the header and pass the pageTitle variable? </p><p>A. <jsp:insert page='/WEB-INF/jsp/header.jsp'>${pageTitle='Welcome Page'}</jsp:insert> </p><p>B. <jsp:include page='/WEB-INF/jsp/header.jsp'>${pageTitle='Welcome Page'}</jsp:include> </p><p>C. <jsp:include file='/WEB-INF/jsp/header.jsp'>${pageTitle='Welcome Page'}</jsp:include> </p><p>D. <jsp:insert page='/WEB-INF/jsp/header.jsp'><jsp:param name='pageTitle' value='Welcome Page' /></ jsp:insert> </p><p>E. <jsp:include page='/WEB-INF/jsp/header.jsp'><jsp:param name='pageTitle' value='Welcome Page' /></ jsp:include> </p></div> </div> <div class="qanswer"> <button class="btn btn-success show-btn8" onclick="showhidequesion('8');">Show Answer</button> <a href="https://www.exam2pass.com/1z0-858.html" class="btn btn-warning">Buy Now</a> <div class="myanswer" id="answer8" style="display: none;"> <p>Correct Answer: E </p> </div> </div> </div> <div class="col-lg-12 examQuestions"> <div class="qheader"> Questions 9 </div> <div class="qquestion"> <div class="questionContent"><p>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.) </p><p>A. Add attributes to the session object. </p><p>B. Add attributes on the request object. </p><p>C. Add parameters to the request object. </p><p>D. Use the pageContext object to add request attributes. </p><p>E. Add parameters to the JSP's URL when generating the request dispatcher. </p></div> </div> <div class="qanswer"> <button class="btn btn-success show-btn9" onclick="showhidequesion('9');">Show Answer</button> <a href="https://www.exam2pass.com/1z0-858.html" class="btn btn-warning">Buy Now</a> <div class="myanswer" id="answer9" style="display: none;"> <p>Correct Answer: BE </p> </div> </div> </div> <div class="col-lg-12 examQuestions"> <div class="qheader"> Questions 10 </div> <div class="qquestion"> <div class="questionContent"><p>Which path is required to be present within a WAR file? </p><p>A. /classes </p><p>B. /index.html </p><p>C. /MANIFEST-INF </p><p>D. /WEB-INF/web.xml </p><p>E. /WEB-INF/classes </p><p>F. /WEB-INF/index.html </p><p>G. /META-INF/index.xml </p></div> </div> <div class="qanswer"> <button class="btn btn-success show-btn10" onclick="showhidequesion('10');">Show Answer</button> <a href="https://www.exam2pass.com/1z0-858.html" class="btn btn-warning">Buy Now</a> <div class="myanswer" id="answer10" style="display: none;"> <p>Correct Answer: D </p> </div> </div> </div> <div class="col-lg-12 examQuestions"> <div class="qheader"> Questions 11 </div> <div class="qquestion"> <div class="questionContent"><p>As a convenience feature, your web pages include an Ajax request every five minutes to a special servlet that monitors the age of the user's session. The client-side JavaScript that handles the Ajax callback displays a message on the screen as the session ages. The Ajax call does NOT pass any cookies, but it passes the session ID in a request parameter called sessionID. In addition, assume that your webapp keeps a hashmap of session objects by the ID. Here is a partial implementation of this servlet: </p><p>10.</p><p> public class SessionAgeServlet extends HttpServlet { </p><p>11.</p><p> public void service(HttpServletRequest request, HttpServletResponse) throws IOException { </p><p>12.</p><p> String sessionID = request.getParameter("sessionID"); </p><p>13.</p><p> HttpSession session = getSession(sessionID); </p><p>14.</p><p> long age = // your code here </p><p>15.</p><p> response.getWriter().print(age); </p><p>16.</p><p> } </p><p>... // more code here </p><p>47. } </p><p>Which code snippet on line 14, will determine the age of the session? </p><p>A. session.getMaxInactiveInterval(); </p><p>B. session.getLastAccessed().getTime() - session.getCreationTime().getTime(); </p><p>C. session.getLastAccessedTime().getTime() - session.getCreationTime().getTime(); </p><p>D. session.getLastAccessed() - session.getCreationTime(); </p><p>E. session.getMaxInactiveInterval() - session.getCreationTime(); </p><p>F. session.getLastAccessedTime() - session.getCreationTime(); </p></div> </div> <div class="qanswer"> <button class="btn btn-success show-btn11" onclick="showhidequesion('11');">Show Answer</button> <a href="https://www.exam2pass.com/1z0-858.html" class="btn btn-warning">Buy Now</a> <div class="myanswer" id="answer11" style="display: none;"> <p>Correct Answer: F </p> </div> </div> </div> <div class="col-lg-12 examQuestions"> <div class="qheader"> Questions 12 </div> <div class="qquestion"> <div class="questionContent"><p>Given a portion of a valid Java EE web application's directory structure: </p><p>MyApp | |-- File1.html | |-- Directory1 | |-- File2.html | |-- META-INF |-- File3.html You want to know whether File1.html, File2.html, and/or File3.html will be directly accessible by your web client's browsers. </p><p>Which statement is true? </p><p>A. All three files are directly accessible. </p><p>B. Only File1.html is directly accessible. </p><p>C. Only File2.html is directly accessible. </p><p>D. Only File3.html is directly accessible. </p><p>E. Only File1.html and File2.html are directly accessible. </p><p>F. Only File1.html and File3.html are directly accessible. </p><p>G. Only File2.html and File3.html are directly accessible. </p></div> </div> <div class="qanswer"> <button class="btn btn-success show-btn12" onclick="showhidequesion('12');">Show Answer</button> <a href="https://www.exam2pass.com/1z0-858.html" class="btn btn-warning">Buy Now</a> <div class="myanswer" id="answer12" style="display: none;"> <p>Correct Answer: E </p> </div> </div> </div> <div class="col-lg-12 examQuestions"> <div class="qheader"> Questions 13 </div> <div class="qquestion"> <div class="questionContent"><p>Which method must be used to encode a URL passed as an argument to HttpServletResponse.sendRedirect when using URL rewriting for session tracking? </p><p>A. ServletResponse.encodeURL </p><p>B. HttpServletResponse.encodeURL </p><p>C. ServletResponse.encodeRedirectURL </p><p>D. HttpServletResponse.encodeRedirectURL </p></div> </div> <div class="qanswer"> <button class="btn btn-success show-btn13" onclick="showhidequesion('13');">Show Answer</button> <a href="https://www.exam2pass.com/1z0-858.html" class="btn btn-warning">Buy Now</a> <div class="myanswer" id="answer13" style="display: none;"> <p>Correct Answer: D </p> </div> </div> </div> </div> <div class="col-lg-4"> <div class="col-md-12 no-padding" style="width:360px;"> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data"> <strong>Exam Code: <a href="https://www.exam2pass.com/1z0-858.html">1Z0-858</a></strong> </div> </div> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data"><strong>Exam Name: Java Enterprise Edition 5 Web Component Developer Certified Professional</strong> </div> </div> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data"> <strong>Last Update: Jun 13, 2025</strong> </div> </div> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data"><strong> Questions: 276 </strong> </div> </div> <div class="spacing"></div> <form id="product_form" action="/cart/add" method="post"> <input type="hidden" name="id" value="3319893" /> <input type="hidden" name="items[]" value="3319893" /> <input type="hidden" name="type" value="3" /> <select name="attributes[QAs]" style="display:none"> <option value="238" >238</option> </select> <input type="hidden" name="qty" value="1"> <input type="hidden" name="pack" value="0" id="pack"> </form> <div class="packages" style="width: 360px; position: static; top: 35px;"> <div class="loginmodal-container text-center" style="border: 2px solid #FF9D21; padding: 0px 10px;"> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data"> <h3 style="margin: 0px;">PDF (Q&A)</h3> </div> </div> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data"> <span class="price">$45.99</span> </div> </div> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data text-center"> <a href="javascript:void(0)" class="button button-highlight button-primary button-rounded mr20" onclick="submitform(0);">ADD TO CART</a> </div> </div> </div> <div class="loginmodal-container text-center" style="border: 2px solid #FF9D21; padding: 0px 10px;"> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data"> <h3 style="margin: 0px;">VCE</h3> </div> </div> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data"> <span class="price">$49.99</span> </div> </div> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data"> <a href="javascript:void(0)" class="button button-primary button-rounded mr20" onclick="submitform(1);">ADD TO CART</a> </div> </div> </div> <div class="loginmodal-container text-center" style="border: 2px solid #FF9D21; padding: 0px 10px;"> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data text-center"> <h3 style="margin: 0px;">PDF + VCE</h3> </div> </div> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data"> <span class="price">$59.99</span> </div> </div> <div class="row-eq-height"> <div class="col-sm-12 exam-row-data text-center"> <a href="javascript:void(0)" class="button button-action button-primary button-rounded" onclick="submitform(2);">ADD TO CART</a> </div> </div> </div> </div> </div> </div> </div> </div> </div> <script language="JavaScript"> function submitform(type) { $("#pack").val(type); $("#product_form").submit(); } function showhidequesion(id) { var e = document.getElementById('answer'+id); if(e.style.display == 'block'){ $(".show-btn"+id).html('Show Answer'); e.style.display = 'none'; }else{ $(".show-btn"+id).html('Hide Answer'); e.style.display = 'block'; } } var fixmeTop = $('.packages').offset().top; $(window).scroll(function() { var currentScroll = $(window).scrollTop(); if (currentScroll >= fixmeTop) { $('.packages').css({ position: 'fixed', top: '20', }); } else { $('.packages').css({ position: 'static' }); } }); </script> <div id="footer"> <div class="ifooter"> <h3>Exam2Pass----The Most Reliable Exam Preparation Assistance </h3> <p>There are tens of thousands of certification exam dumps provided on the internet. And how to choose the most reliable one among them is the first problem one certification candidate should face. Exam2Pass provide a shot cut to pass the exam and get the certification. If you need help on any questions or any Exam2Pass exam PDF and VCE simulators, customer support team is ready to help at any time when required.</p> <p class="btmmenu"> <a href="/" title="">Home</a> | <a href="/guarantee-policy.html" rel="nofollow">Guarantee & Policy</a> |  <a href="/privacy.html" rel="nofollow">Privacy & Policy</a> |  <a href="/terms.html" rel="nofollow">Terms & Conditions</a> |  <a href="/how-to-buy.html" rel="nofollow">How to buy</a> |  <a href="/faqs.html" rel="nofollow">FAQs</a> |  <a href="/about-us.html" rel="nofollow">About Us</a> |  <a href="/contact-us.html" rel="nofollow">Contact Us</a> |  <a href="/samples.html" rel="nofollow">Demo</a> |  <a href="/reviews.html" rel="nofollow">Reviews</a></p> <p>2025 Copyright @ exam2pass.com All trademarks are the property of their respective vendors. We are not associated with any of them.</p> </div> </div> </div> </body> </html>