关于foreach循环中遇到的问题小结

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

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

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

<table> <thead> <tr> <th> <input type="checkbox" value="checkbox"> <label>全选 </label> </th> <th>样本编号</th> <th>被检者姓名</th> <th>被检者ID</th> <th>医院名称</th> <th>样本类型</th> <th>手机</th> <th>创建时间</th> </tr> </thead> <c:forEach var="hello" items="${key}" step="1" > <tr> <td> <input type="checkbox" value="${hello.iD}"> </td> <td> <a href="javascript:void(0)" >${hello.sampleNo}</a> </td> <td>${hello.name}</td> <td>${hello.pId}</td> <td>${hello.hospitalName}</td> <td>${hello.sampleType}</td> <td>${hello.cellPhone}</td> <td>${hello.createTime}</td> </tr> </c:forEach> </table>

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyspgp.html