Method of traversing map with JSTL El expression

In El, the square bracket operator is used to retrieve the elements of arrays and collections.

For implementing Java util. A collection of map interfaces. The square bracket operator uses the associated key to find the value stored in the map.

Specify the key in square brackets and return the corresponding value as the value of the expression.

For example, the expression ${map ['key ']} returns the value associated with the "key" key in the map referenced by the map identifier.

When the value of the expression in the items attribute of foreach is Java util. Map, the type of variable named in VaR is Java util. Map. Entry。

If var = entry, use the expression ${entry. Key} to get the key name.

Use the expression ${entry. Value} to get the value of each entry.

This is because Java util. Map. The entry object has getKey and getValue methods, and the expression language follows the naming convention of JavaBeans.

The above is the method of traversing map with JSTL El expression introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>