• Post Reply Bookmark Topic Watch Topic
  • New Topic

Any substitute for TabLibs

 
Sanjay Jadhav
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
I like to know is that the TabLibs are substitute for JavaBeans.
why TabLibs are only use with JSP why not with the Servlet or simple application or others?
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Taglibs, or rather the custom tags within a tag library, and JavaBeans are both technologies for wrapping up common functionality as reusable components. Whereas JavaBeans can be used in JSP, Servlets and simple applications, custom tags are a part of the JSP specification and therefore can only be used with JSP. Essentially, JavaBeans can be reused anywhere that there is Java, while custom tags need to run inside a JSP container.
For a more detailed comparison, including examples of what you might want to use each for, check out Chapter 8 : Tag Patterns (from Professional JSP Tag Libraries) that is free to download in PDF format.
Hope that helps
Simon
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To add to that a little.
If you really need to use a custom tag in a non-JSP context (say if you don't have the source code and it embodies some crucial business knowledge), you can wrap it up in a sort of pseudo-JSP which calls it's lifecycle methods.
For an example of this approach, you can look at Simon's tag tetsing framework.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!