Compare two ArrayList in JSP

Compare two ArrayList:

1.ArrayList are ListOfData and SecondList

2.Include this tag in the JSP Page

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

3.Find the Length of the ArrayList Using fn:length tag

4.Compare the ArrayList as

<c:if test=”${not empty ListOfData}” >
<c:forEach var=”j” begin=”0″ end=”${fn:length(SecondList)-1}”>
<c:forEach var=”i” begin=”0″ end=”${fn:length(ListOfData)-1}”>

<tr>
<c:if test=”${SecondList[j].empid==ListOfData[i].empid}”>
<td>${ListOfData[i].empid} </td>
<td>${ListOfData[i].empname} </td>
<td>${ListOfData[i].empdest} </td>
</c:if>
</tr>
</c:forEach>
</c:forEach>
</c:if>

Popularity: 4% [?]

Related posts:

  1. Pagination in JSP
  2. Custom tags in JSP
  3. JSP Custom tags Example
  4. JSP Applet tag
You can leave a response, or trackback from your own site.

Leave a Reply

Designed by: Business Web Hosting | Thanks to Buy Icons, travel tips and Used Cars