<p>Can anybody explain the idea behind JSP custom tag libraries and the JSP 2 tag files?</p>

<p>Are they just different ways to do the same thing?</p>

<p>How do they compare? What are their pros and cons, and which is better?</p>

Problems Developing Custom Tags
Traditional custom tags require Java programming
skills.
All but the simplest custom tags are not easy to write.
The purpose of JSP, in contrast to servlets, is to use
markup language to manage layout with embedded
dynamic content.
Having to write complex Java code
in custom tags that focus on markup language is going
backwards.
We might want to use the JSP expression language or
other custom tags when implementing a new custom
tag.
The Solution
JSP 2.0 Tag Files
Tag files are one of the important new concepts introduced with JSP 2.0.
Tag files permit easier and more rapid development of custom tags.
Tag files are developed using normal JSP syntax,including scripting elements, and used just like any other custom tag.
Each custom tag is a separate tag file.
How Do Tag Files Differ?
Written using JSP syntax.
Not all JSP directives are permitted in a tag file.
Supported by new tag file specific directives, actions and implicit objects.
Identified by either a
.tag
or
.tagx
suffix.
Intended to provide custom tag developers ease of development without loss of functionality.
One of the lead developers of JSTL has commented thatif she had the time, she would rewrite all of JSTL using tag files.