Use the Length property value of the prefix property of the jstl tag functions
1. First import the JSTL function label on the JSP page
<% @ taglib Prefix = " fn " URI = " http://java.sun.com/jsp/jstl/functions " %>
2. For example, set to Messagelist
<items= "${messagelist}"= "message"> <h3>${fn:length (messagelist)}</h3> </ C:foreach >
This will output the length of the Messagelist collection!
3. Note the difference between the Count property and the following
<items= "${messagelist}"= "message" varstatus= " Go "> <h3>${go.count}</h3 > </ C:foreach >
Current: The item (in the collection) for this iteration.
Index: The current iteration of this iteration, starting at 0.
Count: The iteration count that is currently starting at 1 for this iteration.
First: Used to indicate whether the current iteration is the initial iteration, which is a Boolean type.
Last: Used to indicate whether the current iteration is the final iteration, which is a Boolean type.
The value of the Begin:begin property.
The value of the End:end property
The value of the Step:step property
How to get the length of a collection in <c:foreach > tags in jsp