jsp - Check in EL if array contains specific element -
this question has answer here:
- collection/array contains method 2 answers
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
Post a Comment