Simple tags can have Classic parents

This is not a problem, because a SimpleTag’s getParent() returns type JspTag, and Classic tags and Simple tags now share the JspTag super interface. Actually, Classic tags can have Simple parents, but it takes a slight hack to make that work because you can’t cast a SimpleTag to the Tag return value of the Tag interface getParent(). We won’t go into how to access a Simple tag parent from a Classic child tag[10], but all you need to know for the exam (and almost certainly real web app life) is that by using getParent(), a Classic tag can access Classic tag parents, and a Simple tag can access either a Classic or Simple parent.

image with no caption

Using the getParent() method, a Classic tag can access Classic tag parents, and a Simple tag can access either a Classic or Simple parent.

In a JSP

image with no caption

In the SimpleInner tag handler

image with no caption

In the ClassicParent tag handler

image with no caption


[10] If you’re really curious, look at the TagAdapter class in the J2EE 1.4 API.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset