Given a JSP page:
11. <n:recurse>
12. <n:recurse>
13. <n:recurse>
14. <n:recurse />
15. </n:recurse>
16. </n:recurse>
17. </n:recurse>
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
0. Increment 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.
Explanation: