Prev Next

Web / JSP interview questions

How do I test if a string contains the given value in EL?

Use the fn:contains() or fn:containsIgnoreCase() function.

<c:forEach items="${cartItems}" var="eachItem">
    <c:if test="${not fn:containsIgnoreCase(eachItem, 'egg')}">
        <p> ${eachItem} doesn't contain 'Egg'</p>
    </c:if>
</c:forEach>

More Related questions...

Show more question and Answers...


Comments & Discussions