File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

classic Tag

priya Agrawal
Greenhorn

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.


Thanks
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 -

<my:simpleTag>
<my:classicTag/>
<my:simpleTag>

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.]]


Regards,
Shivani


/** Code speaks louder than words */
 
 
subject: classic Tag
 
Similar Threads
Nesting betn Simple Tag and Classic Tag
How to use TagAdapter ?
re body-content element for custom tags
HFSJ page 550
Simple and Classic tags understanding