【发布时间】:2012-09-25 20:28:21
【问题描述】:
是否有在 JSP 中打印 javabeans 的数组/集合元素的标准方法?我只知道<jsp:getProperty> 标签不能做到这一点。我知道它可以使用自定义标签来完成,但是 JSP 应该提供这样一个基本要求。
另外,我读过使用PageContext、ServletContext 等的setAttribute() 方法,我们可以在Servlet 中获取bean 并对其进行处理,但它给了我null 的价值。
pageContext.getAttribute("beanPropertyVariable") //set in page scope
application.getAttribute("beanPropertyVariable") //set in application scope
我怎样才能做到这一点?
【问题讨论】:
-
我浏览了上面的链接,但没有更简单的解决方案吗?