Hello I am learning Java EE, and now I am on the JSTL part. I am trying to display the variable value using a foreach loop, but the result is always the variable name instead of its value . I searched on the net but I haven't found anything that seems to be helpful. Here is my index.jsp code :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<body>
<c:forEach var="i" begin="0" end="10">
${i}
<c:if test="${i%2==0}">
<p class="text-primary"><c:out value="${i}"/>></p>
</c:if>
<c:if test="${i%2!=0}">
<p class="text-success"><c:out value="${i}"/>></p>
</c:if>
</c:forEach>
</body>
</html>
P.S: I am using maven and the jstl jar is imported I am using 1.2 version. I also tried different versions but in vain. I am using Intellij Ultimate version, this code is working perfectly on Eclipse yet not on Intellij. Thank you for helping!
I solved the problem by changing <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
to <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
But what is the difference between the two links and why it is working when changing it?
Thank you.