Is there is any way to check if expected element is present in array in EL? I don't see any other way other than iterate the whole array and see if value matches the expected one.
            Asked
            
        
        
            Active
            
        
            Viewed 1,098 times
        
    1 Answers
1
            
            
        If you are using Spring Framework, you can use Spring TagLib + SpEL and common-lang3:
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
---
<spring:eval var="containsValue" expression="T(org.apache.commons.lang3.ArrayUtils).contains(yourArray, 'expectedElement')" />
Contains (true or false): ${containsValue}
        xxg
        
- 2,048
 - 1
 - 11
 - 14