Properties of specific meaning JSTL forEach tag

  JSTL's forEach tag in JSP pages often replace loop Java script generates information from multiple records. Generally only

A record of a show can be, and some need to get the index of the current record. The need to obtain the index of the current record when possible

A little trouble, but still simple forEach tag implementation requirements.

 

        forEach tag attributes explain in detail:

        items: the collection will be iterative.

        var: a collection of the current iteration of the elements.

        begin: index of the first element to iterate

        end: The last index to iterate the elements

        step: increment every iteration of the subject, the default is 1. I.e., if the current element in the iteration index is set to 2, the next iteration of the subscript a is an element of the 2 + step

        varStatus: status item. This property than other complex, because it comprises a plurality of attribute value attributes.

                         index property: the current iteration element index in the collection, starting from 0

                         count property: the current iteration element is the collection of several elements, starting at 1. If the index of the current iteration of the element 3, it is the set of four elements, i.e., the count value of 4

                         first property: the current iteration element is the first element in the collection

                         last attribute: the current iteration element is the last element in the collection

                         current property: the current iteration of the element, the element value representing a same value and of the var attribute in the set of attributes

 

        <C: forEach items = "$ {collection}" var = "ele" varStatus = "status"> </ c: forEach>. ele element representing the current iteration, as long to get to use the current element status.index index


Guess you like

Origin www.cnblogs.com/gpxs/p/12063901.html