问题:单选题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); %>
查看答案
问题:多选题A session-scoped attribute is stored by a servlet, and then that servlet forwards to a JSP page. Which threejsp:useBean attributes must be used to access this attribute in the JSP page?()AidBnameCbeanDtypeEscope
问题:单选题Given the web application deployment descriptor elements: 11. 12.ParamAdder 13.com.example.ParamAdder 14.... 24. 25.ParamAdder 26.MyServlet 27. 28. Which element, inserted at line 27,causes the ParamAdder filter to be applied when MyServlet is invokedby another servlet using the RequestDispatcher.include method?()A <include/>B <dispatcher>INCLUDE</dispatcher>C <dispatcher>include</dispatcher>D <filter-condition>INCLUDE</filter-condition>E <filter-condition>include</filter-condition>
问题:单选题Assume a JavaBean com.example.GradedTestBean exists and has two attributes. The attribute name is oftype java.lang.String and the attribute score is of type java.lang.Integer. An array of com.example. GradedTestBean objects is exposed to the page in a request- scoped attribute called results. Additionally,an empty java.util.HashMap called resultMap is placed in the page scope. A JSP page needs to add the firstentry in results to resultMap, storing the name attribute of the bean as the key and the score attribute of thebean as the value. Which code snippet of JSTL code satisfies this requirement?()A ${resultMap[results[0].name] = results[0].score}B <c:set var=${resultMap} key=${results[0].name} value=${results[0].score} />C <c:set var=resultMap property=${results[0].name}> ${results[0].value}</c:set>D <c:set var=resultMap property=${results[0].name} value=${results[0].score} />E <c:set target=${resultMap} property=${results[0].name} value=${results[0].score} />
问题:多选题Given: 11. 15. Which three EL expressions, inserted at line 15,are valid and evaluate to "3"?()A${vals.2}B${vals[2]}C${vals.index}D${vals[index]}E${vals}[index]F${vals[vals[index-1]]}
问题:单选题Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here26. } Which should you insert at line 25 to properly invoke the next filter in the chain,or the target servlet if thereare no more filters?()A chain.forward(request, response);B chain.doFilter(request, response);C request.forward(request, response);D request.doFilter(request, response);
问题:单选题Your IT department is building a lightweight Front Controller servlet that invokes an application logic objectwith the interface: public interface ApplicationController {public String invoke(HttpServletRequest request)} The return value of this method indicates a symbolic name of the next view. From this name, the FrontController servlet looks up the JSP URL in a configuration table. This URL might be an absolute path or apath relative to the current request. Next, the Front Controller servlet must send the request to this JSP togenerate the view. Assume that the servlet variable request is assigned the current HttpServletRequestobject and the variable context is assigned the webapp’s ServletContext. Which code snippet of the FrontController servlet accomplishes this goal?()A Dispatcher view=context.getDispatcher(viewURL);view.forward Request(request, response);B Dispatcher view=request.getDispatcher(viewURL);view.forward Request(request, response);C RequestDispatcher view. =context.getRequestDispatcher(viewURL);view.forward(request,response);D RequestDispatcher view=request.getRequestDispatcher(viewURL);view.forward(request, response);
问题:单选题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?()A Create an HttpSessionListener class and implement the sessionInitialized method with that block ofcode.B Create an HttpSessionActivationListener class and implement the sessionCreated method with thatblock of code.C Create a Filter class, call the getSession(false) method, and if the result was null, then execute that block of code.D Create an HttpSessionListener class and implement the sessionCreated method with that block of code.
问题:单选题Servlet A receives a request that it forwards to servlet B within another web application in the same webcontainer. Servlet A needs to share data with servlet B and that data must not be visible to other servlets inA’s web application. In which object can the data that A shares with B be stored?()A HttpSessionB ServletConfigC ServletContextD HttpServletRequestE HttpServletResponse
问题:多选题You need to store a floating point number,called Tsquare,in the session scope. Which two code snippetsallow you to retrieve this value?()Afloat Tsquare = session.getFloatAttribute(Tsquare);Bfloat Tsquare = (Float) session.getAttribute(Tsquare);Cfloat Tsquare = (float) session.getNumericAttribute(Tsquare);Dfloat Tsquare = ((Float) session.getAttribute.(Tsquare)).floatValue();Efloat Tsquare = ((Float) session.getFloatAttribute.(Tsquare)).floatValue;
问题:单选题You have a new IT manager that has mandated that all JSPs must be refactored to include no scritpletcode. The IT manager has asked you to enforce this. Which deployment descriptor element will satisfy thisconstraint?()A <jsp-property-group>. <url-pattern>*.jsp</url-pattern>. <permit-scripting>false</permit-scripting>. </jsp-property-group>B <jsp-config>. <url-pattern>*.jsp</url-pattern><permit-scripting>false</permit-scripting>. </jsp-config>C <jsp-config>. <url-pattern>*.jsp</url-pattern>. <scripting-invalid>true</scripting-invalid>. </jsp-config>D <jsp-property-group>. <url-pattern>*.jsp</url-pattern>. <scripting-invalid>true</scripting-invalid>. </jsp-property-group>
问题:多选题A web application allows the HTML title banner to be set using a servlet context initialization parametercalled titleStr. Which two properly set the title in this scenario?()A<title>${titleStr}</title>B<title>${initParam.titleStr}</title>C<title>${params[0].titleStr}</title>D<title>${paramValues.titleStr}</title>E<title>${initParam[’titleStr’]}</title>
问题:多选题Which two are characteristics of the Front Controller pattern?()AIt simplifies remote interfaces to distributed objects.BIt promotes cleaner application partitioning and encourages reuse.CIt provides an initial point of contact for handling all related requests.DIt reduces maintainability due to the increased complexity of the design.EIt provides loosely coupled handlers that can be combined in various permutations.
问题:单选题For debugging purposes, you need to record how many times a given JSP is invoked before the user’ssession has been created. The JSP’s destroy method stores this information to a database. Which JSPcode snippet keeps track of this count for the lifetime of the JSP page?()A <%! int count = 0; %><% if ( request.getSession(false) == null ) count++; %>B <%@ int count = 0; %>. <% if ( request.getSession(false) == null ) count++; %>C <% int count = 0;. if ( request.getSession(false) == null ) count++; %>D <%@ int count = 0;. if ( request.getSession(false) == null ) count++; %>E <%! int count = 0;. if ( request.getSession(false) == null ) count++; %>
问题:多选题Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated with MyServlet and its only tagsand tags are:GETPUT Admin Which four requests would be allowed by the container?()AA user whose role is Admin can perform a PUT.BA user whose role is Admin can perform a GET.CA user whose role is Admin can perform a POST.DA user whose role is Member can perform a PUT.EA user whose role is Member can perform a POST.FA user whose role is Member can perform a GET.
问题:多选题Given an HttpServletRequest request: 22.String id = request.getParameter("jsessionid"); 23.// insert code here 24.String name = (String) session.getAttribute("name"); Which three can be placed at line 23 to retrieve anexisting HttpSession object?()AHttpSession session = request.getSession();BHttpSession session = request.getSession(id);CHttpSession session = request.getSession(true);DHttpSession session = request.getSession(false);EHttpSession session = request.getSession(jsessionid);
问题:多选题Which two security mechanisms can be directed through a sub-element of the element in a web application deployment descriptor?()AAuthorizationBData integrityCConfidentialityDAuthentication
问题:单选题The Squeaky Bean company has decided to port their web application to a new J2EE 1.4 container. Whilereviewing the application, a developer realizes that in multiple places within the current application, nearlyduplicate code exists that finds enterprise beans. Which pattern should be used to eliminate this duplicatecode?()A Transfer ObjectB Front ControllerC Service LocatorD Intercepting FilterE Business DelegateF Model-View-Controller
问题:单选题The JSP developer wants a comment to be visible in the final output to the browser. Which comment styleneeds to be used in a JSP page?()A <!-- this is a comment -->B <% // this is a comment %>C <%-- this is a comment --%>D <% /** this is a comment **/ %>
问题:多选题Which two actions protect a resource file from direct HTTP access within a web application?()APlacing it in the /secure directoryBPlacing it in the /WEB-INF directoryCPlacing it in the /META-INF/secure directoryDCreating a element within the deployment descriptor