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

Discussion in 'Java' started by Anonymous, Jul 26, 2004.

  1. Anonymous

    Anonymous Guest

    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>
    Anonymous, Jul 26, 2004
    #1
    1. Advertising

  2. Anonymous

    Cid Guest

    On 26 Jul 2004 01:13:04 -0700, (Anonymous)
    wrote:

    >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.
    Cid, Jul 26, 2004
    #2
    1. Advertising

  3. Anonymous

    phamlen

    Joined:
    Aug 31, 2006
    Messages:
    1
    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" %>
    phamlen, Aug 31, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marie Griffiths Remove Rubbish

    jstl sql taglib database error codes

    Marie Griffiths Remove Rubbish, Apr 10, 2004, in forum: Java
    Replies:
    0
    Views:
    900
    Marie Griffiths Remove Rubbish
    Apr 10, 2004
  2. Robert Mark Bram

    Custom JSTL that accepts JSTL expression

    Robert Mark Bram, Dec 15, 2004, in forum: Java
    Replies:
    0
    Views:
    956
    Robert Mark Bram
    Dec 15, 2004
  3. Steven
    Replies:
    1
    Views:
    1,787
    Ryan Stewart
    Jan 31, 2005
  4. Nagaraj
    Replies:
    1
    Views:
    840
    Lionel B
    Mar 1, 2007
  5. DaFoot
    Replies:
    1
    Views:
    1,671
    DaFoot
    Oct 23, 2008
Loading...

Share This Page