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:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.