Iterative label detailed

Source: Internet
Author: User

Varstatus is an attribute of the <C:FOREACH>JSTL cyclic label, taking varstatus= "status", in effect defining an object named status as the binding value of the varstatus. The binding value, which is the status encapsulates the current traversal state, for example, can be viewed from the object by traversing to the first few elements: ${status.count}. We often use the C tag to traverse the required data, the Varstatus property can implement some functions related to the number of rows, such as: odd rows, even row differences, the last line of special processing, and so on.

Varstatus properties commonly used in the summary of parameters:

${status.index}: Output line number, starting from 0.

${status.count}: Output line number, starting from 1.

${status.current}: The item in the current iteration (in the collection).

${status.first}: Determines whether the current item is the first item in the collection, and the return value is true or false.

${status.last}: Determines whether the current item is the last item in the collection, and the return value is true or false.

Begin, end and step are respectively: Starting serial number, ending serial number, jumping pace. Such as:

<c:foreach begin= ' 1 ' end= ' 5 ' step= ' 2 ' items= ' ${list} ' var= ' item ' >

The 1~5 data in the list collection is not a one-by-one loop, but a value per 2. The 1th, 3, and 5 data in the operation set.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.