File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes classic Tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "classic Tag" Watch "classic Tag" New topic

classic Tag

priya Agrawal

Joined: Feb 20, 2006
Posts: 15
Tags questions are:

1)What is difference between tag implement by classic tag and Simple Tag
2)Can I nested a classic tag action in the simple tag action please explain
3)Can I nested a simple tag action in the classic tag action please explain
4)Can Classic and simple tag both include jsp in the body.

Shivani Chandna
Ranch Hand

Joined: Sep 18, 2004
Posts: 380
custom tag can be implemented by simple and classic tag handlers.
The simple tag has as its name suggests - simplified API. Especially for body-content execution and evaluation(uses JspFragment).

Looking at the tld one cannot distinguish if the tag is simple or classic.

Classic tag can alone(and not simple tag)can have JSP as body-content.
Simple tags need to have scriptless body.

Simple and Classic tags can be nested in each other.
Only the issue is if you nest classic tag inside simple tag -


One needs to use the class TagAdapter for getting parent. Since simple tag is of type JspTag and Classic tag is of type Tag. (Remember Tag is subclass of JspTag).From the API:

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.

TagAdapter(SimpleTag adaptee) - constructor
JspTag getAdaptee() - returns the JspTag reference to Classic tag.
[[ Gets the tag that is being adapted to the Tag interface.]]


/** Code speaks louder than words */
I agree. Here's the link:
subject: classic Tag
It's not a secret anymore!