How can i know the size of an ArrayList through any of the struts logic tag and EL or JSTL?
I am sending an arraylist consisting of several objects from action and before iterating it in jsp I want to check whether the arraylist is not null or its size is greater than zero. To solve it I don't want to use scriptlet .Please try to provide the solution with struts logic tag,EL or jstl.
Saptarshi Chakraborty wrote:I want to check whether the arraylist is not null ...
I advice never to return a "null" arraylist, instead return an empty arraylist.
Still, if you can't change underlying code, and set the null array, I suspect it won't get included in any scope as its null.
so, if you have case like this:
Saptarshi Chakraborty wrote:or its size is greater than zero.
To check size, Two possible solutions
- the empty keyword
- the fn:length function (not available in JSTL1.0)