[英]org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'id'
When I try to run my web page, I am getting this error: 当我尝试运行网页时,出现此错误:
org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'id'.
org.apache.jasper.JasperException:javax.el.PropertyNotFoundException:类'java.lang.String'没有属性'id'。
And this is my code: 这是我的代码:
<%@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 : Aug 11, 2017, 9:57:00 PM
Author : Samson Christopher
--%>
<sql:query var="categories" dataSource="jdbc/estore">
SELECT * FROM category
</sql:query>
<div id="indexLeftColumn">
<div id="welcomeText">
<p>[welcome text]</p>
<!--test to access context parameter-->
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>``
And I need to submit my project within 5 days, please somebody help! 我需要在5天内提交我的项目,请有人帮忙!
You have done a mistake in your code. 您在代码中犯了一个错误。 You have used parentheses(round) instead of curly braces.
您使用了圆括号(而不是花括号)。
Mistake
错误
items="$(categories.rows)"
You should have written 你应该写
items="${categories.rows}"
inside the foreach tag. 在foreach标记内。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.