Hi I am using following code to retrieve the values of a list but it does not show anything.
My class code is:
private List MyList;
public List getMyList() {
System.out.println("MyList:"+MyList.get(0).toString());
return MyList;
}
public void setMyList(List MyList) {
this.MyList = MyList;
}
My jsp:
<c:forEach var="item" items="${MyList}">
<div>${item}</div>
</c:forEach>
Result in console : MyList:Swimming
but no result in browser !!!!
Since jstl expressions will be evaluated by the naming convention for getters/setters, you have to use the following inside your jsp:
${myList}will be evalutated togetMyList().