Evaluate list.contains string in JSTL

后端 未结 10 1204
青春惊慌失措
青春惊慌失措 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:53

    You need to use the fn:contains() or fn:containsIgnoreCase() function.

    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
    

    ...

     
            

    Doesn't contain 'apple'

    or

    
                

    Contains 'Apple'

    Note: This will work like mylist.toString().contains("apple") and if this is not what you are looking for better use a other approach.

提交回复
热议问题