Studying the excellent Head First
Servlets and
JSP book and am having a little trouble with one of the
Coffee Cram questions...
Chaper 10 Custom Tag Development
Mock Exam Chapter 10
Question 17
Given a tag,
simpleTag, whose handler is implemented using the Simple tag model and a tag,
complexTag, whose handler is implemented using the Classic tag model.
Both tags are declared to be non-empty in the TLD.
Which JSP code snippets are valid uses of this tag? (Choose all that apply)
A.
<my:simpleTag>
<my:complexTag />
</my:simpleTag>
B.
<my:simpleTag>
<%= displayText %>
</my:simpleTag>
C.
<my:simpleTag>
<%@ include file="/WEB-INF/web/common/headerMenu.html" %>
</my:simpleTag>
D.
<my:simpleTag>
<my:complexTag>
<% i++; %>
</my:complexTag>
</my:simpleTag>
----------------------------------------
A and C are correct.
Option A seems to be a classic tag with a simple parent.
Page 540 of the text leads off with the bold title:
"Simple tags can have Classic parents"
before going onto explain that using the getParent() method a classic tag can access classic tag parents and a simple tag can access
either a classic or simple parent.
Should A be incorrect as it's a classic tag with a simple parent?