1. Iteration
When the expression value in the items attribute of foreach is Java. util. MAP, the type of the 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 obtain the value of each entry. This is because java. util. Map. entry objects include getkey and getvalue
The Expression Language complies with the naming conventions of JavaBean.
Example:
<C: foreach items = "$ {map}" Var = "entry">
<C: Out value = "$ {entry. Key}"/>
<C: Out value = "$ {entry. Value}"/>
</C: foreach>
2. Evaluate the value based on the key variable
If you know the key in advance, it is easy to get the value object according to $ {map. Key Value}. What if the key is a variable?
One problem is how to use el to get an object for a given key variable. here we need to use [] in the El expression to solve this problem,
The solution is as follows:
<C: Out value = "$ {map [Key]}"/>
<! -- The map here is the java. util. map object, and the key is a key in the map -->