JSP+JSTL cant output values using <c: taglib. "attribute items does not accept any expressions"

A

Anonymous

Hi this file gives me

org.apache.jasper.JasperException: /Continue.jsp(18,0) According to
TLD or attribute directive in tag file, attribute items does not
accept any expressions

It complains about line 18
18: <c:forEach var="row" items="${result.rowsByIndex}">
19: <c:eek:ut value="${row[0]}"/> <br />
20: </c:forEach>

Any idea how to solve this?
I put all the jar files in WEB-INF/lib from the jakarta standard
taglibs /lib folder as the docs said to.

im using apache Tomcat 5 + J2SE 1.4

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)

<!-- Continue.jsp -->
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>


<html>
<head>
<title>Continue</title>
</head>
<body bgcolor="#fffff">

<sql:setDataSource driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/college?user=root&password=robbo"/>
<sql:query var="result">
SELECT * FROM student
</sql:query>

<c:forEach var="row" items="${result.rowsByIndex}">
<c:eek:ut value="${row[0]}"/> <br />
</c:forEach>

</body>
</html>
 
C

Cid

Hi this file gives me

org.apache.jasper.JasperException: /Continue.jsp(18,0) According to
TLD or attribute directive in tag file, attribute items does not
accept any expressions

It complains about line 18
18: <c:forEach var="row" items="${result.rowsByIndex}">
19: <c:eek:ut value="${row[0]}"/> <br />
20: </c:forEach>

Ok, this is wierd. It worked for me initially. Apparently due to the
fact that EL is not evaluated by default for me (v2.3 web.xml). If I
add a page directive to enable EL
<% page isELIgnored='false' %>

Then I get your same error. I suspect EL is on for you by default, so
try it with a page directive turning it off (isELIgnored='true') to
see if that affects it.

This doesn't make sense to me. The examples in the spec use EL. Your
syntax looks fine to me and according to the spec.

Do you have anything in your web.xml affecting EL? What version DTD is
your web.xml in - and what jstl library version do you have (check the
jar's manifest.mf file).

I'm stumped at this point but maybe someone else will know what's
going on.
 
Joined
Aug 31, 2006
Messages
1
Reaction score
0
The answer

Just posting a solution for those who end up on this page after googling about this problem. I finally solved this with help from Josh Brown. This is what he wrote (and which I found on another forum.)


If you're getting the error "According to TLD or attribute directive in tag file,
attribute items does not accept any expressions.", you're probably using an
outdated URI for the core tag library.

CODE EXAMPLE
<c:forEach var="name" items="${names}">
${name}
<br/>
</c:forEach>

OUTDATED URI
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

CORRECT URI
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top