单选题For manageability purposes, you have been told to add a "count" instance variable to a critical JSP Document so that a JMX MBean can track how frequent this JSP is being invoked. Which JSP code snippetmust you use to declare this instance variable in t

题目
单选题
For manageability purposes, you have been told to add a "count" instance variable to a critical JSP Document so that a JMX MBean can track how frequent this JSP is being invoked. Which JSP code snippetmust you use to declare this instance variable in the JSP Document?()
A

<jsp:declaration>int count = 0;<jsp:declaration>

B

<%! int count = 0; %>

C

<jsp:declaration.instance>int count = 0;. <jsp:declaration.instance>

D

<jsp:scriptlet.declaration>int count = 0;. <jsp:scriptlet.declaration>

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Every page of your web site must include a common set of navigation menus at the top of the page. Thismenu is static HTML and changes frequently,so you have decided to use JSP’s static import mechanism. Which JSP code snippet accomplishes this goal?()

  • A、<%@ import file=’/common/menu.html’ %>
  • B、<%@ page import=’/common/menu.html’ %>
  • C、<%@ import page=’/common/menu.html’ %>
  • D、<%@ include file=’/common/menu.html’ %>
  • E、<%@ page include=’/common/menu.html’ %>

正确答案:D

第2题:

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++; %>

正确答案:A

第3题:

You are creating a class that performs complex financial calculations.The class contains a method named GetCurrentRate that retrieves the current interest rate and a variable named currRate that stores the current interest rate.You write serialized representations of the class.You need to write a code segment that updates the currRate variable with the current interest ratewhen an instance of the class is deserialized.Which code segment should you use?()

A.

B.

C.

D.


参考答案:D

第4题:

You have created a JSP that includes instance variables and a great deal of scriptlet code. Unfortunately,after extensive load testing, you have discovered several race conditions in your JSP scriptlet code. To fixthese problems would require significant recoding, but you are already behind schedule. Which JSP codesnippet can you use to resolve these concurrency problems?()

  • A、<%@ page isThreadSafe=’false’ %>
  • B、<%@ implements SingleThreadModel %>
  • C、<%! implements SingleThreadModel %>
  • D、<%@ page useSingleThreadModel=’true’ %>
  • E、<%@ page implements=’SingleThreadModel’ %>

正确答案:A

第5题:

You are writing a JSP that includes scriptlet code to declare a List variable and initializes that variable to anArrayList object. Which two JSP code snippets can you use to import these list types?()

  • A、<%! import java.util.*; %>
  • B、<%! import java.util.List;import java.util.ArrayList; %>
  • C、<%@ page import=’java.util.List’import=’java.util.ArrayList’ %>
  • D、<%@ import types=’java.util.List’types=’java.util.ArrayList’ %>
  • E、<%@ page import=’java.util.List,java.util.ArrayList’ %>
  • F、<%@ import types=’java.util.List,java.util.ArrayList’ %>

正确答案:C,E

第6题:

Your web application uses a simple architecture in which servlets handle requests and then forward to aJSP using a request dispatcher. You need to pass information calculated by the servlet to the JSP;furthermore, that JSP uses a custom tag and must also process this information. This information mustNOT be accessible to any other servlet, JSP or session in the webapp. How can you accomplish this goal?()

  • A、Store the data in a public instance variable in the servlet.
  • B、Add an attribute to the request object before using the request dispatcher.
  • C、Add an attribute to the context object before using the request dispatcher.
  • D、This CANNOT be done as the tag handler has no means to extract this data.

正确答案:B

第7题:

You have been assigned to manage a set of databases. The previous DBA did not leave you notes regarding the structure of each of the databases. While analyzing an instance, you notice that the system identifier (SID) for the instance is set to ’+ASM’. What is the purpose of this instance?()

  • A、 This instance is being used to manage the operating system files.
  • B、 This instance is being used to manage the files of other databases.
  • C、 This instance is being used to manage the instances of other databases.
  • D、 This instance is being used to manage the background processes of other instances.

正确答案:B

第8题:

For manageability purposes, you have been told to add a "count" instance variable to a critical JSP Document so that a JMX MBean can track how frequent this JSP is being invoked. Which JSP code snippetmust you use to declare this instance variable in the JSP Document?()

  • A、<jsp:declaration>int count = 0;<jsp:declaration>
  • B、<%! int count = 0; %>
  • C、<jsp:declaration.instance>int count = 0;. <jsp:declaration.instance>
  • D、<jsp:scriptlet.declaration>int count = 0;. <jsp:scriptlet.declaration>

正确答案:A

第9题:

You are creating a new JSP page and you need to execute some code that acts when the page is firstexecuted, but only once. Which three are possible mechanisms for performing this initialization code?()

  • A、In the init method.
  • B、In the jspInit method.
  • C、In the constructor of the JSP’s Java code.
  • D、In a JSP declaration, which includes an initializer block.
  • E、In a JSP declaration, which includes a static initializer block.

正确答案:B,D,E

第10题:

To take advantage of the capabilities of modern browsers that use web standards, such as XHTML andCSS, 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 severalweb forms to create screen-specific validation functions and are included in these pages with the followingstatement: 10. 11.  14. 15. Which JSP code snippet declares that this JSP Document is a JavaScript file?()

  • A、<%@ page contentType=’application/javascript’ %>
  • B、<jsp:page contentType='application/javascript' />
  • C、<jsp:document contentType='application/javascript' />
  • D、<jsp:directive.page contentType='application/javascript' />
  • 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.

正确答案:D

更多相关问题