;

JSTL is one component of the Java Enterprise Edition (Java EE – formerly J2EE) suite of technologies. The JSTL is just like any other tab library except that it is controlled by Sun Microsystems and offers the user a standard tool kit that covers the majority of the common tasks a site developer will carry out. The tags a divided into four libraries:

At first sight it would seem that JSTL is fairly pointless - JSP pages can contain Java code in the form of scriptlets and nothing the JSTL does is particularly challenging for a software developer. The problem is software developers rarely make good page designers and page designers rarely make good software developers. What was needed was a simple standard way for page designers to access functionality that could be provided by the development team and in particular make use of standard routines. Further more, scriptlets break the flow of a page for the designer -€“ Java code looks nothing like HTML mark up which generally means page development software can't mark it up. If that wasn't enough the code contained in a scriptlet can not be shared across pages meaning a lot of code often ends up being duplicated in multiple places.

JSTL fixes most of the problems associated with scriptlets. They allow web designers the ability to use standard functionality and the JSTL syntax is XML and therefore easily processed by standard page design tools. The four libraries available cover the majority of the problems faced by a page designer but also still leave the option for scriptlets. Finally the JSTL can make use of the JSP Expression Language (EL) a powerful extension that makes it possible to call arbitrary getters and setters on Java objects.

It's not all good news - there are disadvantages to using tag libraries. Tags are generally more expensive to process than scriptlets. In both cases the code is compiled into the servlet that is created from the JSP file but a scriptlet is pretty much just copied in verbatim. A tag, on the other hand, comes with a substantial amount of baggage. Personally I don't feel speed is that much of an issue. The over head of using a tag rather than a scriptlet is minimal and I feel it is highly unlikely that the tags would be the reason a slow site is slow.

The other possible problem with the JSTL is that it doesn't do what you want it to. Scriptlets are infinitely flexible and if you need to do some complex processing they can provide functionality that you don't otherwise have. On the other hand though if you are straying outside the functionality offered by the JSTL it would be wise to consider developing your own tag library.