my dog learned polymorphism
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Calssic Vs Simple Custom tags 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 "Calssic Vs Simple Custom tags" Watch "Calssic Vs Simple Custom tags" New topic

Calssic Vs Simple Custom tags

senthil rajan
Ranch Hand

Joined: Aug 31, 2005
Posts: 36

Please clarify my doubt.

What are the differences between Simple & classic custom tags? I think By using Simple custom tags, we can do all the stuff, then why we go for classic Custom tags?

singh santosh
Ranch Hand

Joined: Jan 13, 2006
Posts: 136
hi senthil,

yeh u r quite right ,y need to use custom tag when everything can be done be SimpleTag so simply...
But since SimpleTag is added from JSP2.0 so what about the code written before JSP2.0.What if u come across them some day while maintaining somebodys code .So we must know how they work(there is a good explanation in HFSJ also).
And its also on the exam .

Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 951
hi senthil,

The Simple tag have a simpler life-cycle than the old custom tag. In most of the cases Simple tags are easy to develop than the Custom tags, as there is normaly only doTag method is to be implemnt.

But the Simple tag handlers are not reused. So every-time it create a new object when it invoked. This may be extra burden, if that tag object is complex.

Secondly, Yo can not use the JSP as the body-content to the Simple tag. That means You can not have Scripting element processing in Simple tag.

In case you want to process the non standard body (tagdependent) instead of only passing it to the output Stream, it require extra effords in case of Simple tags. The bodyContent object in the give you the methods to return the body as String.

Hope this help you


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
I agree. Here's the link:
subject: Calssic Vs Simple Custom tags
It's not a secret anymore!