Which <foreach> Attribute Specifies Element Alias?
The correct answer is 'item'.
The '
For example:
<foreach collection="list" item="item" separator=",">
#{item.name}
</foreach>
In this example, 'item' is the alias for each element in the 'list' collection. Inside the '
The other options are incorrect:
- 'OA' and 'OB' are not valid attributes of the '
' tag. - 'collection' is used to specify the collection or array to iterate over.
- 'index' is used to specify the index of the current element in the iteration.
- 'separator' is used to specify the separator to use between each iteration.
Therefore, the correct answer is 'item'.
原文地址: https://www.cveoy.top/t/topic/oCEP 著作权归作者所有。请勿转载和采集!