JSTL c:loop works but c:out doesn't

P

P.Hill

I have what I think is a weird config problem.
The following JSP
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<body>
<c:forEach var="i" begin="1" end="5" step="1">
<c:eek:ut value="${i}" />

<br />
</c:forEach>
</body>
</html>

produces:

${i}
${i}
${i}
${i}
${i}

instead of the expected
1
2
3
4
5

I'm on Tomcat 5.0
using JSTL 1.1.2
Placing jstl.lib and standards.lib in the app
tld files in app WEB-INF
which is defined in my web.xml
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>

What could be wrong?

-Paul
 
W

Wendy Smoak

P.Hill said:
<c:forEach var="i" begin="1" end="5" step="1">
<c:eek:ut value="${i}" /> <br />
</c:forEach>

Try just
<c:forEach var="i" begin="1" end="5" step="1">
${i}<br/>
</c:forEach>

Your container is apparently evaluating the expression before it gets passed
to <c:eek:ut>.

You're correct that it's a configuration issue... I *think* it's controlled
by which dtd you specify in web.xml, but you probably don't want to drop
back to the prior version to "fix" this, just stop using <c:eek:ut> and use the
expressions directly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top