You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael McCallister <r2...@email.sps.mot.com> on 2001/04/10 17:48:00 UTC
Re: How to display the size of an Collection attribute of a bean?
At 03:33 AM 4/10/2001, you wrote:
>I want to display the size of an Collection attribute of a Bean using
>Struts taglibs. I can use scriptlet but are there any other ways to do that?
>
>Regards,
>Thai
Based on a response from hal.deadman@tallan.com to a bug I filed, it
appears you can use the bean:size tag to do what you want. Here is a
snipped from the bug tracking system that should illustrate getting the
number of elements into a bean. For your problem, you would then use
bean:write to display this item count in your HTML (instead of using
logic:equal to check the size).
! ------- Additional Comments From hal.deadman@tallan.com 2001-03-30 16:20
-------
! I had a similar problem awhile ago and Craig created the bean:size tag. This
! can be used along with logic tags to do what you want.
!
! <bean:size id="numlineitems" name="userorderdetail"
property="orderLineItems"
! scope="request" />
! <logic:equal name="numlineitems" value="0" >
! <bean:message key="emptylist.noitemsinorder"/>
! </logic:equal>
! <logic:greaterThan name="numlineitems" value="0" >
! ...
! </logic:greaterThan>