提问人:Khanh Luong Van 提问时间:12/18/2022 更新时间:12/18/2022 访问量:224
使用 Spring Json 时如何在 HTML 上获取和显示数据
How to get and display data on HTML when using Spring Json
问:
我正在使用Spring获取json数据,然后我想在HTML页面上显示数据。
这是我的班级:
@RequestMapping(value = "/selectCountNotification.do")
public ResponseEntity<List<EgovMap>> selectCountNotification(@RequestParam Map<String, Object> params, ModelMap model) throws Exception {
System.out.println("########################################");
System.out.println("####################check log####################");
System.out.println("########################################");
List<EgovMap> countNotification = orderDetailService.selectCountNotification(params);
model.addAttribute("countNotification", countNotification);
return ResponseEntity.ok(countNotification);
}
这是我的标题.jsp
<li>
<div class="notification" style="top: -5px;left: -40px;height: 36px;">
<i class='far fa-bell' style='font-size:20px'>
<div id="not">
<%@ include file="/WEB-INF/jsp/sales/order/countNotify.jsp"%>
</div>
</i>
</div>
</li>
这是我的伯爵通知.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<p>data: </p>
<c:forEach items="${countNotification}" var="comm">
<p><c:out value="${comm.countNotify}"/></p>
</c:forEach>
当我通过URL调用时:
http://localhost:8080/sales/order/selectCountNotification.do
我从数据库中获取数据值如下:
12
但是当我运行我的jsp是countNotify.jsp时,它无法获得任何值,那么我该如何解决问题呢?
答: 暂无答案
评论