關於「foreach循環」中遇到的幾個問題總結

1.列表頁面用"foreach循環"的時候數據沒有顯示,此時須要檢查你對象模型中屬性的首字母是否大寫切記不能大寫(本人在作一個項目的時候,對象模型是別人創建的,屬性首字母大寫了,致使最後列表頁面數據不顯示,後來一問老師,說改成小寫,瞬間好了)。
2.數據存儲不到表裏:在映射文件中沒有指定數據表列名的時候,數據表列名必須和屬性名相同(應用於hibername操做數據庫中)。javascript

3.用foreach的時候,從其餘頁面跳到本頁面數據內容不顯示,此時在其餘頁面中必須把跳轉到本頁面的路徑改成瀏覽器中的訪問路徑。java

 1 <table class="table_style">
 2                             <thead>
 3                                 <tr>
 4                                     <th>
 5                                             <input id="all" type="checkbox" onclick="selectAll();" value="checkbox"> 
 6                                         <label>全選 </label>
 7                                     </th>
 8                                     <th>樣本編號</th>
 9                                     <th>被檢者姓名</th>
10                                     <th>被檢者ID</th>
11                                     <th>醫院名稱</th>
12                                     <th>樣本類型</th>
13                                     <th>手機</th>
14                                     <th>建立時間</th>
15                                 </tr>
16                             </thead>
17                             <c:forEach var="hello" items="${key}" step="1" >
18                                 <tr>
19                                     <td>
20                                           <input  type="checkbox"   value="${hello.iD}" name="checkbox">
21                                     </td>
22                                     <td>
23                                         <a href="javascript:void(0)">${hello.sampleNo}</a>
24                                     </td>
25                                     <td>${hello.name}</td>
26                                     <td>${hello.pId}</td>
27                                     <td>${hello.hospitalName}</td>
28                                     <td>${hello.sampleType}</td>
29                                     <td>${hello.cellPhone}</td>
30                                     <td>${hello.createTime}</td>
31                                 </tr> 
32                             </c:forEach>   
33 
34                         </table>
相關文章
相關標籤/搜索