81,092
社区成员
发帖
与我相关
我的任务
分享
public String listAll(){
List<Product> plist=pservice.findAllProds();
ActionContext context=ActionContext.getContext();
context.getSession().put("productlist",plist);
for(Product p:plist){
pid=p.getPid();
}
return "listAll";
}
然后jsp再用标签去遍历
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
//...
<c:forEach items="${sessionScope.productlist}" var="t">
<div>
<p>${t.pname}</p>
<p>${t.price}</p>
</div>
</c:forEach>
<s:iterator></iterator>
<s:property>