jstl的foreach问题

奥数题 2012-01-13 03:09:41
用hibernate配置了一对多的关系
一:m 表
多: p 表
===========以上结果都ok的=========================
在list.jsp显示中需要显示以下内容

---ID----m的名称----m中p的个数

那么jsp的写法是

<c:forEach items="${list}" var="item" varStatus="info">
<tr>
<td>${info.index+1}</td>
<td>${item.Id}</td>
<td>${item.Name}</td>
<td>${item.aPoi.size()}</td>
</tr>
</c:forEach>


上面的${item.aPoi.size()}出错,那统计该怎么表示。
...全文
26 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
奥数题 2012-01-13
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wychjl 的回复:]
导入<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
统计${fn:length(list)}
[/Quote]
正解。谢谢。
笨翔 2012-01-13
  • 打赏
  • 举报
回复
导入<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
统计${fn:length(list)}

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧