Reputation: 4642
To start with, here's my controller:
@RequestMapping(method = RequestMethod.POST, value = "/searchMedia")
public ModelAndView searchAndDisplayResource(@RequestParam String name, @RequestParam String type){
ResultSet rs;
DBQuery dbQuery = new DBQuery();
rs = dbQuery.getMediaInfo(name, type);
if (!rs.isBeforeFirst()) {
// String mediaInfoJson = omdbApiHelper.getMediaDetail(name);
//parse the json, create the mio and persist
return null;
} else {
MediaInfoHelper mediaInfoHelper = new MediaInfoHelper();
ArrayList<MediaInfoModel> mediaList = mediaInfoHelper.getQueriedMediaList(rs);
System.out.println(mediaList.size());
ModelAndView mav = new ModelAndView("mediainfo");
mav.addObject("mediaList",mediaList);
return mav;
}
}
And here's my JSP:
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<body>
<c:if test="${not empty lists}">
<ul>
<c:forEach var="mediaInfo" items="${mediaList}">
<li>${mediaInfo.name}</li>
</c:forEach>
</ul>
</c:if>
</body>
</html>
The size of the list is 1, for the query that I am trying. The problem is that the list just won't get displayed. Can someone please tell me where I am going wrong?
Thanks!
Upvotes: 0
Views: 32
Reputation: 5122
Try changing from:
<c:if test="${not empty lists}">
To:
<c:if test="${not empty mediaList}">
Upvotes: 1