Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to iterate through a list in JSP using Spring framework

So, I have a list that I passed it through the model from my Spring controller to JSP. How do I iterate through the list inside the JSP?

Assume, the list has several hyperlinks that I would like to display in JSP. How to do this without scriptlets?

like image 564
Mohamed Taher Alrefaie Avatar asked Oct 03 '13 13:10

Mohamed Taher Alrefaie


1 Answers

you can use jstl tag and display the list

<c:forEach var="listVar" items="${listName}"> //add the model attribute of list in items
    <option value ="10"><c:out value="${listVar.attribute}"/></option>
</c:forEach>
like image 191
Chirag Kathiriya Avatar answered Oct 20 '22 17:10

Chirag Kathiriya