JSP page to display ArrayList elements using Iterator

By | May 30, 2015

An Example which explains how to display ArrayList elements using Iterator interface in java.

//ArrayList which contains list of subject names which is coming

ArrayList<Test> subjectList =(ArrayList) request.getAttribute("subjectList");
<form action="StudentController" name="formName" method="post" >
<table cellspacing="2" cellpadding="2">
<tr><th>Subject List</th><th>Select Test</th></tr>

// Iterating through subjectList
Iterator<Test> iterator = subjectList.iterator();
Test testBean = iterator.next();
<input type="radio" name="subject" value="<%=testBean.getSubjectId()%>"/>
<input type="submit" value="Take Test" />

Please Share: Tweet about this on TwitterShare on FacebookShare on Google+Share on RedditPin on PinterestShare on LinkedInDigg thisShare on StumbleUponShare on TumblrBuffer this pageShare on VKEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *