单选题The tag handler for n:recurse extends SimpleTagSupport.Assuming an n:recurse tag can either contain an empty body or another n:recurse tag, which strategy allows the tag handler for n:recurse to output the nesting depth of the deepest n:recurse tag?()A

题目
单选题
The tag handler for n:recurse extends SimpleTagSupport.Assuming an n:recurse tag can either contain an empty body or another n:recurse tag, which strategy allows the tag handler for n:recurse to output the nesting depth of the deepest n:recurse tag?()
A

 It is impossible to determine the deepest nesting depth because it is impossible for tag handlers that extend SimpleTagSupport to communicate with their parent and child tags

B

 Create a private non-static attribute in the tag handler class called count of type int initialized to      oIncrement count in the doTag method. If the tag has a body, invoke the fragment for that body. Otherwise, output the value of count

C

 Start a counter at 1. Call getChildTags(). If it returns null, output the value of the counter.      Otherwise, increment counter and continue from where getChildTags() is called. Skip      processing of the body.

D

 If the tag has a body, invoke the fragment for that body. Otherwise, start a counter at 1. Call      getParent(). If it returns null, output the value of the counter. Otherwise, increment the counter      and continue from where getParent() is called.

参考答案和解析
正确答案: C
解析: 暂无解析
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

The tag timeout value for a cisco wireless location appliance should be set to which tag beacon rate?()

  • A、4 to 6 times the tag beaconing rate
  • B、10 to 12 times the tab beaconing rate
  • C、8 to 10 times the tag beaconing rate
  • D、6 to 8 times the tag beaconing rate

正确答案:C

第2题:

A custom JSP tag must be able to support an arbitrary number of attributes whose names are unknown when the tag class is designed.  Which two are true? ()

  • A、 A  element in the echo tag LTD must have the value JSP
  • B、 The echo tag handler must define the setAttribute (String key, String value) method
  • C、 The true element must appear in the echo tag TLD
  • D、 The class implementing the echo tag handler must implement the javax.sevlet.jsp.tagext.IterationTag interface
  • E、 The class implementing the echo tag handler must implement the javax.sevlet.jsp.tagext.DynamicAttributes interface

正确答案:C,E

第3题:

阅读以下说明和C语言函数,将应填入(n)处的语句写在对应栏内。

【说明】

设串s和串t采用顺序存储结构,编写函数实现串s和串t的比较操作,要求比较结果包括大于、小于和等于3种情况。

【函数】

int StrCompare(SStrType s, SStrType t)

{

int n=s.length, m=(1), i,j,tag;

i=0; j=0;

while((2))

{

if((3))

{

i++;

j++;

}

else if(s.str[i]>t.str[j])

{

tag=1;

return tag;

}

else

{

tag=-1;

return tag;

}

}

if(n==m)

tag=0;

else if((4))

tag=1;

else if(n<m)

tag=-1;

(5);

}


正确答案:(1)t.length (2)in&&jm (3)s.str[i]==t.str[j] (4)n>m (5)retrun tag
(1)t.length (2)in&&jm (3)s.str[i]==t.str[j] (4)n>m (5)retrun tag 解析:本题考查用C语言程序实现对串的操作。
题目要求对顺序存储的串s和串t进行比较,且比较结果可能是大于、小于和等于3种情况。对串的操作是考试中容易出现的内容,串是指由任意个字符构成的有限序列。要判断两个串的大小是通过串中元素的比较来实现的。
第(1)空是对刚声明的变量进行赋初值操作,前面的n中存放了串s的长度,而对于串t的长度在程序中一直没求过,而是用m来表示,那么此空是将串t的长度存放到变量m中。因此,此空答案为t.length。
第(2)空是循环的判断条件,从程序不难看出此循环的作用是实现对串s和串t的比较,在进行比较串时,需要对串中逐个元素进行比较,只要串中还有元素,比较就需继续,而判断串中是否还有元素是通过串的长度来实现的。两个串中元素的长度分别存放在变量n和变量m中,因此,此空答案为in&&jm。
第(3)空是条件判断语句的条件,如果这个条件成立,则两个串中的元素都往后移动一个,再结合下面的程序,不难看出此条件的作用是判断当前两个元素是否相等,如果相等,则执行下面语句。因此,此空答案为s.str[i]==t.str[j]。
第(4)空也是条件判断语句的条件,题目要求比较结果可能是大于、小于和等于三种情况,程序中已经考虑了其中小于和等于的情况,那么此空应该是考虑大于的情况,因此,此空答案为n>m。
第(5)空在程序的最后,题目中要求函数能返回运算的结果,而根据程序的内容,我们知道结果存放在变量tag中,因此,此空答案为return tag。

第4题:

Given the Tag:   Assuming the tag referenced by my Tags: get Advice uses the Classic event model,  which is true?()

  • A、 The do After Body method is called.
  • B、 The doEnd Tag method is NOT called.
  • C、 The type attribute may be specified in the TLD
  • D、 The do Start Tag Method must always return SKIP_BODY.
  • E、 The TLD for this tag must NOT include a  tag.

正确答案:C

第5题:

Which two statements are true about the security-related tags in a valid Java EE deployment descriptor?()

  • A、Every  tag must have at least one  tag.
  • B、A  tag can have many  tags.
  • C、A given  tag can apply to only one  tag.
  • D、A given  tag can contain from zero to many  tags.
  • E、It is possible to construct a valid  tag such that,for a given resource,no user rolescan access that resource.

正确答案:B,E

第6题:

You are creating a content management system (CMS) with a web application front-end. The JSP thatdisplays a given document in the CMS has the following general structure: 1. <%-- tag declaration --%> 2.  ... 11. ...  ... ... 99.  The citation tag must store information in the document tag for the document tag to generate a referencesection at the end of the generated web page. The document tag handler follows the Classic tag model andthe citation tag handler follows the Simple tag model. Furthermore, the citation tag could also be embeddedin other custom tags that could have either the Classic or Simple tag handler model. Which tag handlermethod allows the citation tag to access the document tag?()

  • A、public void doTag() {JspTag docTag = findAncestorWithClass(this, DocumentTag.class); ((DocumentTag)docTag).addCitation(this.docID);}
  • B、public void doStartTag() {JspTag docTag = findAncestorWithClass(this, DocumentTag.class); ((DocumentTag)docTag).addCitation(this.docID);}
  • C、public void doTag() {. Tag docTag = findAncestor(this, DocumentTag.class); . ((DocumentTag)docTag).addCitation(this.docID);. }
  • D、public void doStartTag() {. Tag docTag = findAncestor(this, DocumentTag.class); . ((DocumentTag)docTag).addCitation(this.docID);. }

正确答案:A

第7题:

Assume a tag handler extends TagSupport. Which is used within the tag handler to get an attribute “foo” that is in the application scope?()

  • A、 pageContext.getAttribute(“foo”);
  • B、 getPageContext().getAttribute(“foo”);
  • C、 pageContext.getApplicationScope(“foo”);
  • D、 pageContext.getAttribute(“foo”,pageContext.APPLICATION_SCOPE).getAttribute(“foo”);
  • E、 getPageContext().getScope(pageContext.APPLICATION_SCOPE).getAttribute(“foo”);

正确答案:D

第8题:

The tag timeout value for a Cisco Wireless Location Appliance should be set to which tag beaconrate?()

  • A、4 to 6 times the tag beaconing rate
  • B、10 to 12 times the tab beaconing rate
  • C、8 to 10 times the tag beaconing rate
  • D、6 to 8 times the tag beaconing rate

正确答案:C

第9题:

Assume the tag handler for a st:simple tag extends Simple Tag Support. In what way can scriptlet code beused in the body of st:simple?()

  • A、Set the body content type to JSP in the TLD
  • B、Scriptlet code is NOT legal in the body of st:simple.
  • C、Add scripting-enabled="true" to the start tag for the st:simple element
  • D、Add a pass-through Classic tag with a body content type of JSP to the body of st:simple, and place the scriptlet code in the body of that tag

正确答案:B

第10题:

Under what two circumstances is the set JspBody method NOT called in a tag class that implements the Simple Tag interface? ()

  • A、 The tag is invoked without a body.
  • B、 The doTAb method throws an exception.
  • C、 The  element has the value empty.
  • D、 The tag is called with the attribute skip-body=true

正确答案:A,C

更多相关问题