Java
T
point
Home
Python
Java
JavaScript
HTML
SQL
PHP
C#
C++
DS
Aptitude
Reasoning
Selenium
DBMS
C
Android
Interview Q
Content Menu ▼
1
2
3
4
5
6
7
8
9
10
Question 1
:
The tl:taskList and tl:task tags output a set of tasks to the response and are used as
follows:
11. <tl:taskList>
12. <tl:task name="Mow the lawn" />
13. <tl:task name="Feed the dog" />
14. <tl:task name="Do the laundry" />
15. </tl:taskList>
The tl:task tag supplies information about a single task while the tl:taskList tag does
the final output. The tag handler for tl:taskList is TaskListTag. The tag handler for
tl:task is TaskTag. Both tag handlers extend BodyTagSupport. Which allows the
tl:taskList tag to get the task names from its nested tl:task children?
1.
It is impossible for a tag handler that extends BodyTagSupport to communicate
with its parent and child tags.
2.
In the TaskListTag.doStartTag method, call super.getChildTags() and iterate
through the results. Cast each result to a TaskTag and call getName().
3.
In the TaskListTag.doStartTag method, call getChildTags() on the PageContext
and iterate through the results. Cast each result to a TaskTag and call getName().
4.
Create an addTaskName method in TaskListTag. Have the
TaskListTag.doStartTag method, return BodyTag.EVAL_BODY_BUFFERED. In the TaskTag.doStartTag method, call super.getParent(), cast it to a TaskListTag, and call
addTaskName().