which sets a cookie "username" with t

Given an HttpServletRequestrequest and HttpResponseresponse, which sets a cookie “username” with the value “joe” in a servlet? A. request.addCookie(“username”, “joe”) B. request.setCookie(“username”, “joe”) C. response.addCookie(“username”, “joe”) D. request.addHeader(new Cookie(“username”, “joe”)) E. request.addCookie(new Cookie(“username”, “joe”)) F. response.addCookie(new Cookie(“username”, “joe”)) G. response.addHeader(new Cookie(“username”, “joe”)) Show Answer

Read More

Which two retrieve the value of the header from a given HttpServletRequest request?

Given a header in an HI IP request:X-Retries: 4A Which two retrieve the value of the header from a given HttpServletRequest request? (Choose two) A. request-getHeader(“X-Retries”) B. request.getlntHeader(“X-Retries”) C. request.getRequestHeader(“X-Retries”) D. request.getHeaders{“X-Retries”).get(0) E. request.getRequestHeaders(“X-Retries”).get(0) Show Answer

Read More

Which EL code snippet will generate the string for the previous week?

You are building a web application with a scheduling component. On the JSP, you need to show the current date, the date of the previous week, and the date of thenext week.To help you present this information, you have created the following EL functions in the `d’ namespace:· Name : curData; signature: java.util.utilDate CurrentDate() · […]

Read More

What is the result?

Given:1. <% int[] nums = {42,420,4200};2. request.setAttribute(“foo”, nums); %>3. ${5 + 3 It 6}4. S(requestScope[‘foo’][0] ne 10 div0>5. ${10 div 0}What is the result? A. true true B. false true C. false true 0 D. true true Infinity E. false true Infinity F. An exception is thrown G. Compilation or translation fails Show Answer

Read More

Which three EL expressions, inserted at line 15, are valid and evaluate to “3”?

Given:11. <%12. request.setAttribute (“vals”, new String[] {“1”, “2”, “3”, “4”});13. request.setAttribute (“index”, “2”);14. %>15. <% – – insert code here – – %>Which three EL expressions, inserted at line 15, are valid and evaluate to “3”? (Choose three) A. ${vals.2} B. ${vals [“2”] } C. ${vals.index} D. ${vals[index] } E. ${vals} [index] F. ${vals. (vals.index) […]

Read More

Which two properly set the title in the scenario?

A web application allows the HTML title banner to be set using a context initialization parameter called titlestr.Which two properly set the title in the scenario? (Choose two) A. <title> $ {titlestr} </title> B. <title> $ {initparam.titlestr}</title> C. <title> $ {param [0]. titlestr} </title> D. <title> $ {paramValues.titleStr} </title> E. <title> $ {initParam [`titleStr’] } […]

Read More

What is the result?

Given the element from the web application deployment descriptor:<jsp property group><url pattern>/main/page1.jsp</url pattern><scripting invalid>true</scripting invalid></jsp–property–group>And given that /main/page1.jsp contains:<% int i = 12; %><b> <%= i %> </b>What is the result? A. <b> <b> B. <b> l2 </b> C. The JSP fails to execute. D. <% int i = 12 %> <b> <%= i % […]

Read More