关于“foreach循环”中遇到的几个问题总结

来源:互联网 发布:云计算的好处 编辑:程序博客网 时间:2024/06/16 21:58

1.列表页面用"foreach循环"的时候数据没有显示,此时需要检查你对象模型中属性的首字母是否大写,切记不能大写(本人在做一个项目的时候,对象模型是别人建立的,属性首字母大写了,导致最后列表页面数据不显示,后来一问老师,说改为小写,瞬间好了)。

2.数据存储不到表里:在映射文件中没有指定数据表列名的时候,数据表列名必须和属性名相同(应用于hibername操作数据库中)。

3.用foreach的时候,从其他页面跳到本页面数据内容不显示,此时在其他页面中必须把跳转到本页面的路径改为浏览器中的访问路径。

 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>
0 0
原创粉丝点击