Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calssic Vs Simple Custom tags

 
senthil rajan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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?

Thanks,
Senthil
 
singh santosh
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .

regards
-santosh
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic