Read data from HashMap using JSTL tag in JSP without using for each or for loop

后端 未结 1 1439
情深已故
情深已故 2020-12-08 15:06

I want to read data from a hash map in JSP, but without the use of JSTL or a for loop. How can I do this?

相关标签:
1条回答
  • 2020-12-08 15:36

    You need to know the keys beforehand.

    ${map.key}
    

    The above gets the value of map.get("key").


    Or if the key contains dots

    ${map['key.with.dots']}
    

    This gets the value of map.get("key.with.dots").


    Or if it's a dynamic key

    ${map[dynamicKey]}
    

    This gets the value of map.get(dynamicKey).

    0 讨论(0)
提交回复
热议问题