Understanding Collections

printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    

JSTL: JSP Standard Tag Library Kick Start
By Jeff Heaton

Table of Contents
Chapter 5.  Collections, Loops, and Iterators


The term collection has a slightly different meaning in JSTL than it does in Java. In JSTL many different types of objects can function as a collection. In particular, the following types of classes often form collections in JSTL:

  • Any class that implements the java.util.Collection interface

  • Arrays of objects or primitive data types

  • Any class that implements the java.util.Iterator interface

  • Any class that implements the java.util.Enumeration interface

  • Any class that implements the java.util.Map interface

  • Comma-delineated strings (java.lang.String)

All classes that are members of the Java collections API can be used with the JSTL iteration tags. These include LinkedList, ArrayList, Vector, Stack, Set, and Map. Additionally, string items that contain comma-delineated text can be used. Data is often collected using these collection types, and understanding how to access collections using JSTL is important.

One particularly handy feature of JSTL collections is that a comma-delimited string can be iterated over. For example, the list of values Monday, Tuesday, Wednesday, Thursday, Friday could be iterated over to return each day individually. Now, let's look at the JSTL tags that are used with JSTL collections.


    printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    
    Top

    [0672324504/ch05lev1sec1]

     
     


    JSTL. JSP Standard Tag Library Kick Start
    JSTL: JSP Standard Tag Library Kick Start
    ISBN: 0672324504
    EAN: 2147483647
    Year: 2001
    Pages: 93
    Authors: Jeff Heaton

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