代码如下:使用的是jstl1.2
list中总共有三个对象 可是运行时 只是输出了最后一个对象 用staa.count查看 循环只进行了一次
大家帮我看看为什么 谢谢了<c:forEach items="${list}" var="list" varStatus="staa">
<tr>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.noteid }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.membername }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.bookname }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.booktype }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.bookprice }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.bookconcern }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.booklocation }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.lendtime }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.returntime }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.amerce }</span></font></th>
</tr>
</c:forEach>
list中总共有三个对象 可是运行时 只是输出了最后一个对象 用staa.count查看 循环只进行了一次
大家帮我看看为什么 谢谢了<c:forEach items="${list}" var="list" varStatus="staa">
<tr>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.noteid }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.membername }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.bookname }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.booktype }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.bookprice }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.bookconcern }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.booklocation }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.lendtime }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.returntime }</span></font></th>
<th width="10%"><font color="#3e8e88"><span style="font-weight: normal;">${list.amerce }</span></font></th>
</tr>
</c:forEach>
解决方案 »
- jsp发布后的问题,帮帮忙看一下。
- java applet的问题
- 关于iframe嵌套的问题(多个iframe)
- 征求系统方案:网络版进销存
- jdk1.6+tomcat 6.0 在win2003下为什么需要拷贝msvcr71.dll
- 如何监听本机送出的数据
- 急!!!!stuts 页面提交后 转到另一个页面 页面bean没有重新载入,无法显示正确结果
- 高分求得在JSP中实现动态树型菜单程序!急用,毕业设计!!!
- 老总要我做setup,我该怎么办?
- 进入一个jsp界面时,下拉菜单中就有后台查询出来的数据,不会啊
- mysql 中文?
- java cookie在firefox中访问关闭后打开可用,但ie访问关闭后打开失效,急,求救,谢谢
建议你判断下list的对象个数,如果大于1,你就打印,
看有没有打印,若是还打印了,说明你那list确实有3个对象,不过应该不会出现这样
的状况。
建议items="${list}" var="list"改成items="${list}" var="l"试试。
var="item"名字尽量和list不一样试下!一般直接看代码是没错的!
除非是你查询的时候只查到了一条,一般情况下就不可能就只有一条。
仔细检查下查询的代码!
<c:forEach items="${list}" var="item" >
<tr>
<th width="10%"> <font color="#3e8e88"> <span style="font-weight: normal;">${item.noteid } </span> </font> </th>
<th width="10%"> <font color="#3e8e88"> <span style="font-weight: normal;">${item.membername } </span> </font> </th>
<th width="10%"> <font color="#3e8e88"> <span style="font-weight: normal;">${item.bookname } </span> </font> </th>
<th width="10%"> <font color="#3e8e88"> <span style="font-weight: normal;">${item.booktype } </span> </font> </th>
<th width="10%"> <font color="#3e8e88"> <span style="font-weight: normal;">${item.bookprice } </span> </font> </th>
<th width="10%"> <font color="#3e8e88"> <span style="font-weight: normal;">${item.bookconcern } </span> </font> </th>
<th width="10%"> <font color="#3e8e88"> <span style="font-weight: normal;">${item.booklocation } </span> </font> </th>
<th width="10%"> <font color="#3e8e88"> <span style="font-weight: normal;">${item.lendtime } </span> </font> </th>
<th width="10%"> <font color="#3e8e88"> <span style="font-weight: normal;">${item.returntime } </span> </font> </th>
<th width="10%"> <font color="#3e8e88"> <span style="font-weight: normal;">${item.amerce } </span> </font> </th>
</tr>
</c:forEach>这里保证list是个集合,item是list里的元素。。