2017-08-12 54 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標籤內。

相關問題