My POJO has the following list of users and what I am trying to do is loop users and loop languages for each user
public class Display{
private List<User> users;
}
class User{
private name;
private List<Language> languages;
}
class Language {
private int langId;
private String lang;
}
I tried the below code by creating a reference to Display class "disp" and retrieving the users list and looping it in foreach.but it didn't work. I was able to loop a list of objects but this scenario requires looping of a list inside another list.
My jsp
<c:forEach var="user" items="${disp.users}" begin="0" end="${fn:length(disp.users)-1}" step="1">
<table>
<tr>
<td> user.name </td>
</tr>
</table>
<c:forEach var="language" items="${user.languages}" begin="0"
end="${fn:length(user.languages)-1}" step="1">
<table>
<tr>
<td> language.id</td>
</tr>
</table>
</c:forEach>
</c:forEach>
How can I loop user list and languages list for each user? any help is appreciated. Thanks in advance