ArrayList is a class and a member of Java Collection Framework. It is the resizable-array and permit all element including the null. It is similar to Vector but it is unsynchronized. Iterator return the element from the list in proper sequence.
Description of Program:
In this example there are two file index .jsp and postIndex.jsp. The index.jsp fill take the user input from three different textbox and value post to the postIndex.jsp, which take all values and placed into the ArrayList object. Through Iterator all the element of the list in shown in proper sequence
index.jsp<%@page contentType="text/html" pageEncoding="UTF-8"%>
postIndex.jsp:<%@page import="java.util.*" contentType="text/html" pageEncoding="UTF-8"%> <% String str1 = request.getParameter("arraylistvalue1");%> <% String str2 = request.getParameter("arraylistvalue2");%> <% String str3 = request.getParameter("arraylistvalue3");%> <% ArrayList alist = new ArrayList(); alist.add(str1); alist.add(str2); alist.add(str3); %>
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.