I am trying to comparer ArrayList size with integer value but it returns false.
<c:if test="${langages.size()>2}">
//code
</c:if>
When I ${langages.size}
it gives me value 4. What I am missing?
You could do it this way.
<%@ page import="java.util.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
List<String> language = new ArrayList();
language.add("English");
language.add("French");
language.add("Spanish");
pageContext.setAttribute("language", language);
%>
<c:if test="${fn:length(language) > 2}">
list length is greater than 2
</c:if>
${language}
By the way, the code you posted does work for my version of JSTL(1.2.1). Which version are you using?