<C: forEach> label and foreach label
<C: forEach> A tag is used for general data loops. It has the following attributes:
Genus |
Description |
Required? |
Default Value |
Items |
Cyclic Project |
No |
None |
Begin |
Start Condition |
No |
0 |
End |
End Condition |
No |
The last project in the collection. |
Step |
Step Size |
No |
1 |
Var |
Variable name of the current project |
No |
None |
VarStatus |
Variable that shows the loop status |
No |
None |
VaStatus attributes
The varStatus attribute in JSTL is the same as the varStatus attribute. varStatus is used to create a variable with a limited scope. However, the variable named by the varStatus attribute does not store the current index value or the current element, but is assigned to an instance of the javax. servlet. jsp. jstl. core. LoopTagStatus class. This class defines a set of features that describe the current state of iteration. These features are listed below:
Feature Getter description current getCurrent () index getIndex () index of the current iteration (in the Set) current iteration index from 0 count getCount () first isFirst () indicates whether the current iteration is the first iteration () indicates whether the current iteration is the sign of the last iteration. The begin getBegin () begin attribute value end getEnd () end attribute value step getStep () step Attribute Value
Use the vaStatus attribute in c: forEach to obtain the iteration status, for example:
<C: forEach var = "" items = "" varStatus = "status">
<C: out value = "$ {status. current}"/> current object
<C: out value = "$ {status. index}"/> index of this iteration
<C: out value = "$ {status. count}"/> number of iterations
<C: out value = "$ {status. first}"/> whether it is the first iteration object
<C: out value = "$ {status. last}"/> whether it is the last iteration object
</C: forEach>
<C: forEach> the items attribute of the tag supports all standard set types provided by the Java platform. In addition, you can use this operation to iterate elements in an array (including an array of basic types. It supports the following Collection types and iteration elements:
Java. util. Collection: Elements obtained by calling iterator.
Java. util. Map: the Instance obtained through java. util. Map. Entry.
Java. util. Iterator: Iterator element.
Java. util. Enumeration: Enumeration element.
Object instance array: array element.
Basic Type value array: Elements of the encapsulated array.
String to be separated by commas (,): The Sub-String after segmentation.
Javax. servlet. jsp. jstl. SQL. Result: The row obtained by the SQL query.
From: http://www.cnblogs.com/draem0507/archive/2012/09/24/2699745.html
--