Article

Introduction to the Java Standard Tag Library

Page: 1 2 3 4

What's the Big Deal?

As you can see, the JSTL is a large topic. We have only covered a small part of the core and format libraries here; there are also libraries for dealing with XML as well as a set of tags for JDBC access.

By now you’re probably thinking one of two things; either you’re thinking, “That’s great, my pages will stop looking like a mess of scriptlets,” or, “What’s the point? I have to learn all this stuff and I don’t really get any extra functionality.”

As I mentioned at the start of this article, the JSTL is really all about making your life easier in the long run. Using the JSTL helps in a number of areas:

  1. It helps us separate business logic (into JavaBeans) from presentation logic (into JSTL tags).

  2. It allows non-Java developers to write Java code without having to touch any Java.

  3. It will tidy up and simplify your JSP files and stop them looking like a spaghetti of scriptlets.

When you start using the JSTL you will notice it enforces you to write better, cleaner code. It’s a subtle change at first, but as you get more comfortable with the tags, you’ll find it IS faster than developing with scriptlets.

There is a fourth reason for looking into using JSTL in your own projects, and it’s a biggie: Java Server Faces. Sometime next year (2004) will see the arrival of application servers that conform to the JSP 2.0 specification, allowing developers to start using Sun’s much-ballyhooed Java Server Faces framework. It’s an exciting development, and one that JSTL developers will have a head start on; the JSF will make heavy use of the Expression Language as well as the JSTL tags themselves. Making use of the JSTL now will not only help with your projects today, it’ll give you a head start when the JSF servers start coming out in 2004.

Resources

A supremely useful reference is Sun’s JSTL specification PDF, which you can find at:
http://jcp.org/aboutJava/communityprocess/final/jsr052/
It is in PDF format and makes an excellent reference.

The Sun JSTL area is at:
http://java.sun.com/products/jsp/jstl/

A good three part primer at IBM developerWorks:
http://www-106.ibm.com/developerworks/java/library/j-jstl0211.html

The Jakarta JSTL site:
http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/intro.html

Downloads
The Jakarta Implementation can be downloaded at:
http://apache.mirrors.ilisys.com.au/jakarta/taglibs/standard-1.0/binaries/jakarta-taglibs-standard-1.0.4.zip

Tomcat can be downloaded here:
http://apache.planetmirror.com.au/dist/jakarta/tomcat-4/tomcat-4.1.27.zip

If you liked this article, share the love:
Print-Friendly Version Suggest an Article

Sponsored Links

Rate This Article

  • 1
    Poor
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
    Great

Comment on This Article

Have something to say?

Post A Comment

You need to be a member of the SitePoint Forums to comment on this post. Sign Up

Already a member? Post using your SitePoint Forums account: