Pregunta

Below mentiond is my jsp page jstl sql query:

 <sql:query sql="select postname,comments from root.posts"  var="rs"  dataSource="${ds}" />
                    <c:forEach var="row" items="${rs.rows}">
                        <tr>
                            <td align="center"><c:out value="${row.postname}"></c:out></td>
                            <td align="center"><c:out value="${row.comments}"></c:out></td>
                        </tr>
                    </c:forEach>

after executing jsp my error is : attribute items does not accept any expressions and the error cordiate shows at (28,3) which is - <c:foreach var="row" items="${rs.rows}"..

My context.xml file is:

 <Context>
  <Resource name="jdbc/myderby" auth="Container" type="javax.sql.DataSource"
        username="root" password="root"
        driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
        url="jdbc:derby:E:\workspaceDerby\DerbyNew\derbyDb;create=true"
       maxActive="100" maxIdle="30" maxWait="10000" removeAbandoned="true" />
</Context>

My web.xml file:

<resource-ref>
      <description>DB connection</description>
      <res-ref-name>jdbc/myderby</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>

Additional Info:
-- using Embedded Derby for database inside Eclipse-indigo
-- servlet version 3
-- jstl.jar version 1.2, standard.jar version 1.1.2
-- using Html 5
-- Took Tutorial from : here( actually tutorial is using Server version of derby i modified it to Embedded Derby for study purpose)
--Also successfully created crud application with jsp,servlet,jstl using MySql db but not with Embedded Derby (Because Embedded derby is also useful for my Standalone apps and web apps )

¿Fue útil?

Solución

You are using the URI of JSTL 1.0, which doesn't handle expression language.

Correct your JSTL URI to:

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

See the jstl tag faq for more information.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top