JSP List Size is used to get the size of the list. The JSP List Size uses array list object to add the elements and finally return the number of elements are added to the list.
Understand with Example
In this section, you will learn how to get the list size. You can see in the given example that we have import the package java.util.* to create a list of countries using the class List and ArrayList. The method l.size() of class List will return the size of the created list. Finally the out.print ln print the size of elements in the array.
l.size : The method returns the size list of the elements added to an array object.
Here is the code of listSize.jsp
|<%@ page import="java.util.*" %>
List l = new ArrayList();
out.println("The Length of List is: ");
Output will be displayed as:
Posted on: February 4, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles