jsp - Check in EL if array contains specific element -


this question has answer here:

is there way check if expected element present in array in el? don't see other way other iterate whole array , see if value matches expected one.

if using spring framework, can use spring taglib + spel , 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} 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -