I want to check if the ArrayList is null OR not using JSTL c:if and it is not working. Please help me out in this.
My code is here
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
java.util.ArrayList<Student> studentList = MyClass.getStudentList();
%>
<c:if test="${studentList != null}">
<c:forEach var="student" items="${studentList}">
<c:out value="${student.name}" />
</c:forEach>
</c:if>
I also tried
<%
java.util.ArrayList<Student> studentList = MyClass.getStudentList();
%>
<c:if test="${not empty studentList}">
<c:forEach var="student" items="${studentList}">
<c:out value="${student.name}" /><br/>
</c:forEach>
</c:if>
as well as
<%
java.util.ArrayList<Student> studentList = MyClass.getStudentList();
request.setAttribute("studentList", studentList);
%>
<c:if test="${not empty studentList}">
<c:forEach var="student" items="${studentList}">
<c:out value="${student.name}" /><br/>
</c:forEach>
</c:if>
Simple c:if expressions like are working.
What am I doing wrong in this code? Any clues?
Got the solution. That was the issue with JAR files. Now I downloaded JARS from Java.Net site and it is working.