Chapter 15: Using JSTL with Struts

 < Day Day Up > 


A key advantage of working with Struts is its support for the View layer of MVC applications. At the foundation of this support is its JSP tag libraries. As you've seen in the previous four chapters, the tag libraries greatly simplify JSP development and reduce the need to use JSP scriptlets. At the time of their creation, the Struts tag libraries filled a void in JSP functionality. They provided a simple and convenient interface for getting and setting data on Java beans, implementing simple conditional logic, and accessing Web application attributes. Although an important part of Struts, today large portions of the Struts tag libraries have been superceded by the JSP Standard Tag Library (JSTL). Here's why.

Like Struts, many other frameworks and development teams implemented a set of tag libraries to accomplish basic Java bean manipulation and conditional logic functionality inside JSPs. Although several of those implementations are quite similar, each is a little different in the scope of what it can do and each uses different names for its tags and attributes. Because of the duplication of effort across multiple projects, the need arose for a common, standardized set of tag libraries that could be used universally. Having a standardized set of tags would eliminate the need to learn the details of several different tag libraries as well as curtail the duplication of effort across projects. To meet this need, the JSP Standard Tag Library was created. JSTL is an extension to JSP technology that provides a set of standardized tag libraries and a simple expression language (EL) for accessing objects in JSPs.

Because JSTL offers a standardized set of tags, it is now the preferred approach for JSP development with Struts. Thus, applications should use the JSTL tag libraries and expression language instead of the Struts tags wherever possible. This chapter provides a brief introduction to JSTL, a list of the Struts tags that can be replaced by JSTL, and information on the Struts EL tag libraries that support the JSTL expression language.

 < Day Day Up > 

Struts. The Complete Reference
Struts: The Complete Reference, 2nd Edition
ISBN: 0072263865
EAN: 2147483647
Year: 2003
Pages: 134
Authors: James Holmes

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: