我正在尝试确定视图中集合的大小。我不想像在下面的代码中那样传递大小.size()
。
@RequestMapping(value = "/search/searchAndReplace")
public ModelAndView searchAndReplace(HttpServletRequest request, HttpServletResponse response) {
ModelAndView model = new ModelAndView("content/search/searchAndReplace");
List<Content> searchResults = (List<Content>) request.getSession().getAttribute("searchResults");
model.addObject("searchResults", searchResults);
model.addObject("searchResultsCount", searchResults.size());
return model;
}
在我看来,当我做的${searchResultsCount}
事情正常时,当我做的时候${searchResults.size()}
我得到了错误Class javax.el.BeanELResolver can not access a member of class java.util.ArrayList$SubList with modifiers "public"
我不明白为什么会窒息。有人可以提供一些见解吗?