Class TagAdapter

All Implemented Interfaces:
JspTag, Tag

public class TagAdapter extends Object implements Tag
Wraps any SimpleTag and exposes it using a Tag interface. This is used to allow collaboration between classic Tag handlers and SimpleTag handlers.

Because SimpleTag does not extend Tag, and because Tag.setParent() only accepts a Tag instance, a classic tag handler (one that implements Tag) cannot have a SimpleTag as its parent. To remedy this, a TagAdapter is created to wrap the SimpleTag parent, and the adapter is passed to setParent() instead. A classic Tag Handler can call getAdaptee() to retrieve the encapsulated SimpleTag instance.

JSP 2.0
  • Constructor Details

    • TagAdapter

      public TagAdapter(SimpleTag adaptee)
      Creates a new TagAdapter that wraps the given SimpleTag and returns the parent tag when getParent() is called.
      adaptee - The SimpleTag being adapted as a Tag.
  • Method Details