I have a little question...
On my JSP page I have a List of beans. I want to extract a sublist of beans with a specific property (Ex. all Horror books). Can Apache Beanutils help me?
Thanks in advance..开发者_运维技巧.
In a JSP you have 2 options:
Iterate over list yourself using JSTL
<c:forEach>
and test using JSTL<c:if>
if the item matches the requirements and finally just display it.Do the same in plain Java code and call this in a servlet prior to forwarding the request to the JSP. Optionally you can wrap this in an EL function so that you can call it from inside a JSP.
The Commons Beanutils can't help much here. It has as far as I know no collection filter with a predicate. The Commons Collections and Google Collections however have.
精彩评论