Jan. 23, 2011, 2:02 a.m.
posted by franni
JSTL and Other Widely Used Tag Libraries
One of the immediate benefits of JSP tag libraries is the ability to use them across multiple applications, multiple projects, and multiple organizations. A prime example of this is the Java Standard Tag Library (JSTL). This tag library, available from Sun Microsystems, provides a number of utility services in a collection of easy-to-use custom tags.
JSTL includes simple utility tags and a set of conditional tags—if and choose (with its companion when and otherwise tags). There is a powerful pair of iteration (looping) tags, forEach and forTokens. These are useful in writing display pages without writing scriptlets to supply the looping logic.
JSTL also includes a set of tags for working with Web resources including the url, import, and redirect tags. There is also a large set of tags dedicated to supporting internationalization (I18N) of JSPs including the fmt:message tag and a number of format and parsing tags (e.g., formatNumber and parseNumber). Without a good set of I18N tags, providing support for multiple locales in JSPs is a chore and difficult to maintain.
A greater portion of JSPs are being written using standard utility tag libraries. For example, authors of theme and skins (the branding look and feel elements) for WebSphere Portal Server have their JSPs comprised mostly of custom tags from a single tag library, which provides highly optimized and specialized tags for manipulating presentation objects associated with the portal.