javajsp,Servlet:Property 'Id' not found

avax.el.PropertyNotFoundException: Property 'Id' not found on type   org.androidpn.server.model.CarSourceValid

關於這個問題。

字面上告訴你,Id這個屬性 在 CarSourceValid 這個 bean裏面沒有找到。
1.你先到你定義的類,確保 有對應屬性的get(), set()。

2.jsp頁面上引用是否正確。var是實體變量, items是用來循環的數據列表。(屬性前兩位必需要小寫)
<c:forEach var="c" items="${carSourceValidList}">
 <tr> 
 <td><c:out value="${c.id}" /></td> 
 <td><c:out value="${c.fromAddr}" /></td>> 
 </tr> 
 </c:forEach>

3.以上兩個都沒寫錯。你可能發現,若是你把jsp寫成以下:
<c:forEach var="c" items="${carSourceValidList}">
 <tr> 
 <td><c:out value="${c}" /></td> 
 </tr> 
 </c:forEach>
你看到並無報錯,而是看到了對象的名字。這裏證實,數據庫鏈接確定沒有問題。而是第4個問題。

4. org.androidpn.server.model. CarSourceValid  這個實體,也就是對應你所引用的類。屬性名字定義不規範。
檢查你的javabean是否符合規範:屬性命名時前兩個字母只能全是小寫,符合駝峯標識;
相關文章
相關標籤/搜索