Friday, 13 October 2017

Creating List using JSTL

We can create a list and add items to the list using existing jstl tag library (wcf).

Here is the simple example to create new list and add items to list in jsp:

<wcf:useBean var="myNewList" classname="java.util.ArrayList"/>

<c:forEach var=eachItem items="${myOldList}">
<wcf:set value="${eachItem}" target="${myNewList}"/>
</c:forEach>