从action传来一个封装好数据的类Person() {
Sting id;
List pet;
}需要在jsp里遍历显示成下面这种格式:
|-----------
|id | pet |
|-----------
|1 | 猫 |
|-----------
| | 狗 |
|-----------
|2 | 猫 |
|-----------
| | 狗 |
|-----------
| | 鸟 |
|-----------
|3 | 猫 |
|-----------
| | 狗 |
|-----------
请问如何用c:forEach怎么写啊
Sting id;
List pet;
}需要在jsp里遍历显示成下面这种格式:
|-----------
|id | pet |
|-----------
|1 | 猫 |
|-----------
| | 狗 |
|-----------
|2 | 猫 |
|-----------
| | 狗 |
|-----------
| | 鸟 |
|-----------
|3 | 猫 |
|-----------
| | 狗 |
|-----------
请问如何用c:forEach怎么写啊
<c:forEach var="news" items=list"> 调用在取出Person的属性 即可
补充一下,action里传来的是装有person的list
我现在主要问题是如何遍历Person里的pet这个list
<c:forEach items="${plist.pet}" var="petinfo">
</c:forEach>
</c:forEach>
好像是这样