This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Tag library versus Javabean

 
Sandep Chaturvedi
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With both being capable to do what you want (taglib can handle postprocessing), how does one decide, when to use what?
Also writting your custom tag library is a time consuming process with a challenge of integrating the tag library with Java bean.
I havent come across any design pattern or best practices which talks about this.
 
Bill Siggelkow
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally, I like to keep my JavaBeans very business-object like. That is, primarily data containers with some behavior. However, when I want to provide specific presentation behavior based on that data I use a custom tag. Motivations for the custom tag are "can this functionality be used across other pages in my app?" If so, and the behavior is not tied to a specific type of data, then you may want to consider a custom tag. Often a motivation is more practical -- that is, as you build your app you will find places where it seems like you have to use scriptlet ... look at those sections and consider ... Could I put this behavior in the bean I am using? If not, or it doesn't seem appropriate, then probably a custom tag will meet your needs. Also, take a look at Struts, Jakarta TagLibs, and JSTL. Good Luck!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!