リクエストで選択したキャッシュ操作をエコーバックして、ブラウザに表示したい。JSPの経験はほとんどありません。操作の値を表示するにはどうすればよいですか?
JSP:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<body>
<h1>Cache Operation Results - ${operation}</h1>
<ul>
<c:forEach items="${results}" var="nextObject">
<pre>${nextObject.toString()}</pre>
</c:forEach>
</ul>
</body>
</html>
コントローラースニペット:
@RequestMapping(value = "/objectcache", method = RequestMethod.GET)
public ModelAndView objectCache(@RequestParam("operation") String operation, HttpServletRequest req) {
List<String> cacheReturnValue = new ArrayList<String>();
ModelAndView mav = new ModelAndView("/utils/objectCache", "results", cacheReturnValue);
if (operation.equalsIgnoreCase("reload")) {
cacheReturnValue = this.reloadCache();
}
mav.addObject("operation", operation);
return new ModelAndView("/utils/objectCache", "results", cacheReturnValue);
}