Comparison to the Java Standard Tag Library


As this book was being written, a lot of work was being done on other tag libraries and changes were being made to the way JSP fundamentally works. The Struts tag libraries are really just one of a number of ongoing efforts, although they are among the best developed and are currently in widespread use. The Struts tag libraries are

  • Available today on a wide variety of platforms

  • Tightly integrated with Struts MVC architecture

  • Supported by a broad user base

  • Easy to learn and easy to use

However, it's important that you keep your eye on a number of other efforts. The most visible of these are based on work currently being done to extend JSP itself by including in it a number of standard tag libraries. These efforts are referred to as the Java standard tag libraries or JSTL (sometimes referred to as the JSP tag libraries or JSPTL ). The JSTL specification is covered by JSR-52 (Java Specification Request 52) and can be reviewed on the site of the Java Community Process (http://www.jcp.org/jsr/detail/52.jsp).

JSTL itself is a moving target right now, but it will be adopted rapidly because of the significant value it adds by speeding the development and maintenance of your code. Here's a very high-level description of JSTL features:

  • Container hosted ” For a servlet container (such as Tomcat) to be considered JSP 1.2 compliant, it must support JSTL. That means the JSTL tag libraries will work on any servlet container that meets this requirement.

  • Expression language ” In addition to providing JSP custom tags, JSTL also requires a container to provide a basic expression language (EL) that enables the developer to define Boolean and other expressions without having to use Java scriptlets.

  • Multiple tag libraries ” The JSTL specification actually defines multiple tag libraries. This is similar to the way Struts has multiple tag libraries (for example, the bean and HTML libraries). The four initial JSTL libraries are the core , xml, sql, and i18n libraries.

There is some overlap between Struts and JSTL. Over time, the two will likely come closer together and some Struts tags probably will be deprecated as JSTL matures and is more widely supported. It is also very likely that Struts will influence future directions of JSTL to some extent. Many of the people involved in developing JSTL specifications are also involved in the Struts or other Apache/Jakarta projects.

In summary, if your servlet container supports JSP 1.2 and JSTL, it's possible that some functionality for which you would otherwise require Struts might be available directly within the JSTL provided by your container. Whether or not you use Struts or JSTL will depend on your application, your expected migration path , and the timing of your project. The trade-off you'll have to make will be based on your desire for Java standards-compliance versus your desire to leverage Struts and its MVC architecture and tag library.

Until JSP 2.0 becomes final and widely supported, I recommend using Struts where appropriate. Doing so should enhance portability while allowing JSTL to mature.

Note

For more information on the JSP standard tag library, read Sams Publishing's JSTL: JSP Standard Tag Library Kick Start by Jeff Heaton (ISBN: 0672324505).




Struts Kick Start
Struts Kick Start
ISBN: 0672324725
EAN: 2147483647
Year: 2002
Pages: 177

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net