使用ibatis在JSP中显示数据
嗨,我正在尝试使用ibatis在JSP中显示数据。 以下是我的contentstatisController.java页面使用ibatis在JSP中显示数据,jsp,spring-mvc,el,ibatis,Jsp,Spring Mvc,El,Ibatis,嗨,我正在尝试使用ibatis在JSP中显示数据。 以下是我的contentstatisController.java页面 @RequestMapping(value="/contentStatis") public String contentStatis( HttpServletResponse response, ModelMap model, Condition condition, @RequestParam Ma
@RequestMapping(value="/contentStatis")
public String contentStatis(
HttpServletResponse response,
ModelMap model,
Condition condition,
@RequestParam Map<String, Object> maps) throws Exception {
if(!PotSessionUtils.isAdminLogin()) {
PotSessionUtils.goAdminMainPage(response);
} else {
logger.debug("=======================================================>");
logger.debug("파라메타 확인(maps) ========> " + maps);
logger.debug("=======================================================>");
List<ContentStatis> result = ContentStatisRepository.statis(maps);
Pagination<ContentStatis> resultList = PaginationUtil.getPaginationList(result,
condition, (long)result.size(), Order.DESC);
model.addAttribute("condition", condition);
model.addAttribute("resultList", resultList);
}
return "admin/statisMng/contentStatis";
}
现在,下面是JSP页面
(请注意,我只想显示week和WebNT)
你好
但由于某些原因,JSP页面只显示文本“Hello”
它们都不会出现在JSP中。concole中也没有错误消息
但是,colsole仍然显示我在xml页面中编写的整个查询
有人能帮我显示数据吗?我已经被困在这三天了…您正在将模型属性设置为:
model.addAttribute("condition", condition);
model.addAttribute("resultList", resultList);
在JSP页面中,您可以通过以下方式访问它们:
${condition}
${resultList}
要访问resultList
的任何属性,必须使用:
${resultList.property} // property is a bean-style attribute of class whose object is resultList.
要访问结果的列表
:
List<ContentStatis> result = ContentStatisRepository.statis(maps);
然后,您可以在JSP中检索它,如下所示:
${result}
由于它是一个列表
,因此必须使用JSTL迭代它并获取每个ContentStatis
对象:
<c:forEach var="contentStatis" items="${result}" varStatus="i">
Week: ${contentStatis.week} <!-- if contentStatis has week property -->
<br>webCnt: ${contentStatis.webCnt} <!-- if contentStatis has webCntproperty -->
</c:forEach>
周:${contentStatis.Week}
webCnt:${contentStatis.webCnt}
我试过了。base.jsp具有以下特性:在控制器页面中,List result=ContentStatisRepository.statis(映射);我想到了这个。不是吗?谢谢你的回答。但是可以检查一下我刚刚更新的问题吗?我错过了一页要贴的内容。我现在刚刚更新了问题。我非常感谢你的帮助。
${resultList.property} // property is a bean-style attribute of class whose object is resultList.
List<ContentStatis> result = ContentStatisRepository.statis(maps);
model.addAttribute("result", result);
${result}
<c:forEach var="contentStatis" items="${result}" varStatus="i">
Week: ${contentStatis.week} <!-- if contentStatis has week property -->
<br>webCnt: ${contentStatis.webCnt} <!-- if contentStatis has webCntproperty -->
</c:forEach>