O'Reilly logo

JavaServer Pages, Second Edition by Hans Bergsten

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 22. Integrating Custom Code with JSTL

In addition to providing a powerful set of JSP actions, the JSTL specification also provides a number of classes and interfaces that can provide defaults for the JSTL actions and be used to develop custom actions that integrate nicely with JSTL actions. Another component of the JSTL specification is a couple of generic tag library validators you can use to enforce policies in your application, such as preventing scripting elements and restricting the set of tag libraries that can be used.

Using the Expression Language in Custom Actions

First the bad news: the JSTL specification does not include a public interface to the Expression Language (EL) evaluator. The reason for this controversial fact is that it’s expected that the EL will be incorporated into the next JSP specification version, scheduled for release early 2003, and if it is, EL expressions will be handled directly by the container with no extra code required in the custom action tag handlers.

It’s still possible to support EL expressions for custom action attributes, but you have to use the evaluator that’s part of the JSTL Reference Implementation (RI), developed as open source under the Apache Taglibs project, a Jakarta subproject. The drawback with this solution is that you have to make sure the JSTL RI is installed together with your custom tag library. You should also be aware that the evaluator interface may change, since it’s not part of a formal specification. In this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required