what's the fundamental difference between a jsp taglib vs including a jsp page?
jsp, jspinclude, taglib
Solution
When you use a taglib the container typically:
- Writes and calls a helper method from within _jspService
- Inside the helper method an instance of the tag class is created and standard methods are called (setParent(), doStartTag(), doEndTag() etc...)
This keeps all the code within the same resource (the request does not get passed on to another component) and hence allows you to build in looping behaviour and access other components on the current page.
There is overhead in learning Tag Libraries. But once you have got your first tag working its all downhill. Also the end result will be easier for non-developers to understand (assuming you choose good names for the tags).
Problem
i have several common elements (components), that will generate some html. it seems my options are creating a taglib, or just putting that logic into a jsp page and including the jsp. whats the difference? positives vs negatives?