gpt4 book ai didi

java - org.apache.jasper.JasperException/javax.el.PropertyNotFoundException :

转载 作者:行者123 更新时间:2023-12-01 13:17:53 24 4
gpt4 key购买 nike

我是 Java Web 应用程序的新手。我一直在使用教程来学习Java。尝试使用 jSTL 标签时我陷入困境。我有一个包含两个字段的类别表,即“名称”和“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 服务器 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}">

关于java - org.apache.jasper.JasperException/javax.el.PropertyNotFoundException :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22320004/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com