org.apache.jasper.JasperException/javax.el.PropertyNotFoundE



我是Java web应用程序的新手。我一直在使用教程来学习Java。当我试图使用jstl标签时,我卡住了。我有一个类别表与两个字段,即。"名称"one_answers"id"。类别名称和我使用的映像文件名称相同。这里是源代码。当我尝试运行应用程序时,它显示以下错误:

HTTP Status 500 - Internal Server Error
type Exception report
messageInternal Server Error
description
    The server encountered an internal error that prevented it from fulfilling this request.
exception
    org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'id'.
root cause
    javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'id'.
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.0 logs.
GlassFish Server Open Source Edition 4.0 

我在WEB-INF文件夹下的lib文件夹中添加了javax.servlet.jsp.jstl-api-1.2.1-javadoc.jar和jstl-impl-1.2.jar文件。但我仍然遇到上述问题。有谁能帮我一下吗?

这是我的代码index.jsp。我已经在glassfish server 4.0中部署了应用程序
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%-- 
    Document   : index
    Created on : Feb 18, 2014, 1:18:40 PM
    Author     : sabin
--%>
<sql:query var="categories" dataSource="jdbc/affablebean">
    SELECT * FROM category
</sql:query>
<div id="indexLeftColumn">
    <div id="welcomeText">
        <p>[ welcome text ]</p>
        categoryImagePath:${initParam.categoryImagePath}
        productImagePath:${initParam.productImagePath}
    </div>
</div>
<div id="indexRightColumn">
    <c:forEach var="category" items="$(categories.rows}">
        <div class="categoryBox">
            <a href="category?${category.id}">
                <span class="categoryLabelText">${category.name}</span>
                <img src="${initParam.categoryImagePath}${category.name}.jpg" alt="${category.name}">
            </a>
        </div>
    </c:forEach>
</div>

你有一个错别字:$(而不是${。修改这一行

<c:forEach var="category" items="$(categories.rows}">

<c:forEach var="category" items="${categories.rows}">

相关内容

  • 没有找到相关文章

最新更新