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
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
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.
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.
第1题:
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? ()
第2题:
Which two statements are true about the security-related tags in a valid Java EE deployment descriptor?()
第3题:
Given the Tag:
第4题:
Which statement is true if the do Start Tag method returns EVAL_BODY_BUFFERED?()
第5题:
Which three are valid values for the body-content attribute of a tag directive in a tag file?()
第6题:
Which the two are true about the JSTL core iteration custom tags?()
第7题:
pageContext.getAttribute(“foo”);
getPageContext().getAttribute(“foo”);
pageContext.getApplicationScope(“foo”);
pageContext.getAttribute(“foo”,pageContext.APPLICATION_SCOPE).getAttribute(“foo”);
getPageContext().getScope(pageContext.APPLICATION_SCOPE).getAttribute(“foo”);
第8题:
The tag handler must extend body Tag.
The do After Body method is NOT called.
The set Body Content method is called.
It is never legal to return EVAL_BODY_BUFFERED from do Start Tag.
第9题:
The do After Body method is called.
The doEnd Tag method is NOT called.
The type attribute may be specified in the TLD
The do Start Tag Method must always return SKIP_BODY.
The TLD for this tag must NOT include a
第10题:
public void doTag() {JspTag docTag = findAncestorWithClass(this, DocumentTag.class); ((DocumentTag)docTag).addCitation(this.docID);}
public void doStartTag() {JspTag docTag = findAncestorWithClass(this, DocumentTag.class); ((DocumentTag)docTag).addCitation(this.docID);}
public void doTag() {. Tag docTag = findAncestor(this, DocumentTag.class); . ((DocumentTag)docTag).addCitation(this.docID);. }
public void doStartTag() {. Tag docTag = findAncestor(this, DocumentTag.class); . ((DocumentTag)docTag).addCitation(this.docID);. }
第11题:
The tag is invoked without a body.
The doTAb method throws an exception.
The
The tag is called with the attribute skip-body=true
第12题:
Set the body content type to JSP in the TLD
Scriptlet code is NOT legal in the body of st:simple.
Add scripting-enabled=true to the start tag for the st:simple element
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
第13题:
Assume a tag handler extends TagSupport. Which is used within the tag handler to get an attribute “foo” that is in the application scope?()
第14题:
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?()
第15题:
Under what two circumstances is the set JspBody method NOT called in a tag class that implements the Simple Tag interface? ()
第16题:
Assume the tag handler for a st:simpletag extends SimpleTagSupport. In what way can scriptlet code be used in the body of st:simple?()
第17题:
The sl:shoppingList and sl:item tags output a shopping list to the response and are used as follows:
第18题:
ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling getParent() and castingthe result to ShoppingListTag.
ShoppingListTag can find the child instances of ItemSimpleTag by calling super.getChildren() andcasting each to an ItemSimpleTag.
It is impossible for ItemSimpleTag and ShoppingListTag to find each other in a tag hierarchy becauseone is a Simple tag and the other is a Classic tag.
ShoppingListTag can find the child instances of ItemSimpleTag by calling getChildren() on thePageContext and casting each to an ItemSimpleTag.
ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling findAncestorWithClass()on the PageContext and casting the result to ShoppingListTag.
第19题:
Set the body content type to JSP in the TLD
Scriptlet code is NOT legal in the body of st:simple
Add scripting-enabled= “true” to the start tag for the st:simple element
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.
第20题:
A
The echo tag handler must define the setAttribute (String key, String value) method
The
The class implementing the echo tag handler must implement the javax.sevlet.jsp.tagext.IterationTag interface
The class implementing the echo tag handler must implement the javax.sevlet.jsp.tagext.DynamicAttributes interface
第21题:
EL
JSP
Empty
Dynamic
Scriptless
Tagdependent
第22题:
The do Start Tag method is called once.
The do After Body method is NOT called.
The EVAL_Page constant is a valid return value for the do End Tag Method.
the EVAL_BODY_BUFFERED constant is a valid return value for the do Start Tag method.
第23题:
ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling getParent() and castingthe result to ShoppingListTag.
ShoppingListTag can find the child instances of ItemSimpleTag by calling super.getChildren() andcasting each to an ItemSimpleTag.
It is impossible for ItemSimpleTag and ShoppingListTag to find each other in a tag hierarchy becauseone is a Simple tag and the other is a Classic tag.
ShoppingListTag can find the child instances of ItemSimpleTag by calling getChildren() on thePageContext and casting each to an ItemSimpleTag.
ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling findAncestorWithClass()on the PageContext and casting the result to ShoppingListTag.