Evaluate list.contains string in JSTL

后端 未结 10 1210
青春惊慌失措
青春惊慌失措 2020-12-07 14:08

I need to hide an element if certain values are present in the JSP

The values are stored in a List so I tried:



        
10条回答
  •  遥遥无期
    2020-12-07 14:51

    If you are using EL 3.0+, the best approach in this case is as this other answer explained in another topic:

    For a Collection it's easy, just use the Colleciton#contains() method in EL.

    ...
    ...
    ...
    

    For an Object[] (array), you'd need a minimum of EL 3.0 and utilize its new Lambda support.

    ...
    ...
    ...
    

    If you're not on EL 3.0 yet, you'd need to create a custom EL function. [...]

提交回复
热议问题