2017-08-12 55 views
0

当我尝试运行我的网页时,出现此错误:org.apache.jasper.JasperException:javax.el.PropertyNotFoundException:类'java.lang.String'没有'id'属性

org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'id'.

这是我的代码:

<%@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>`` 

,我需要在5日内提交项目,请有人帮助!

+0

嘿!你检查我的答案吗? –

回答

0

您在代码中犯了错误。你使用括号(圆)而不是花括号。
错误

items="$(categories.rows)" 

你应该写

items="${categories.rows}" 

在foreach标签内。

相关问题