Hello!
I am trying to write a simple test web application using JSTL and encountered the following problem:
JSTL core tags are working fine (like <c
ut ...>, <c:forEach...>
but the EL expressions are not evaluated. Below is a simple test page that demonstrates the problem:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>JSTL WISS Preview</title>
</head>
<body bgcolor="#FFFFFF">
<jsp:useBean id="directory"
class="test_wiss_JSTL.WISSDirectoryDataBean" />
<br>
Total number of Files (JSTL): <c
ut value="${directory.totalNumFiles}"/>
<br>
Total number of Files (JSP):
<jsp:getProperty name="directory" property="totalNumFiles"/>
<br>
<c:forEach var="i" begin="1" end="5">
<c
ut value="${i}"/><br>
</c:forEach>
<c:forEach var="file" items="${directory.fileList}">
<c
ut value="${file}"/><br>
</c:forEach>
</body>
</html>
The result (in the browser) is:
Total number of Files (JSTL): ${directory.totalNumFiles}
Total number of Files (JSP): 2
${i}
${i}
${i}
${i}
${i}
${file}
So, as you can see, the <c:xxx> tags work correctly , the usual JSP tags work correctly also and the bean's totalNumFiles value is shown correctly too, but when I try to show the same value using the EL expression (${directory.totalNumFiles} ) - it does not work. Nor does a simple integer value ${i} - not a bean's property...
It seems I'm missing something very obvious - just cannot see it just yet. Any ideas?
I use Tomcat5.0.12. I did try to include the JSTL's jar files (standard.jar and jstl.jar) into my web application's WEB-INF/lib directory, even though they are in the $CATALINA/commons/lib - it did not help.
Thanks!
Marina