jsp回写不了数据
时间: 2019-04-08来源:博客园
前景提要
jsp回写不了数据
0 悬赏园豆: 100 [待解决问题] @RestController
@RequestMapping("/category")
public class CategoryController {
@Autowired
private CategoryService categoryService; @RequestMapping("/findAll.do") public ModelAndView findAll(){ List<DangdangCategory> categoryList = categoryService.findAll(); ModelAndView mv = new ModelAndView(); mv.addObject("categoryList",categoryList); mv.setViewName("category"); return mv; }
}
<%@page contentType="text/html;charset=utf-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<SCRIPT type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.4.3.js"></SCRIPT>
<script type="text/javascript">
$(function () {
$.get("${pageContext.request.contextPath}/category/findAll.do", {}, function () { }) })
</script>
<div class="book_l_border1" id="__FenLeiLiuLan">
<div class="book_sort_tushu">
<h2>
分类浏览
</h2>
<!--1级分类开始-->
<div class="bg_old" onmouseover="this.className = 'bg_white';"
onmouseout="this.className = 'bg_old';">
<c:forEach var="oneCategoryList" items="${categoryList}">
<h3>
[<a href='#' id="oneCategoryList">${oneCategoryList.name}</a>]
</h3>
<ul class="ul_left_list">
<!--2级分类开始-->
<c:forEach var="twoCategoryList" items="${oneCategoryList.listCates}">
<p>
<a href='' id="twoCategoryList">${twoCategoryList.name}</a>
</p>
</c:forEach>
<!--2级分类结束--> </ul> <div class="empty_left"> </div> </c:forEach> </div> <div class="more2"> </div> <!--1级分类结束--> <div class="bg_old"> <h3> </h3> </div> </div>
</div>
kangood | 初学一级 | 园豆: 102
提问于:2019-04-08 12:09 显示帮助
使用"Ctrl+Enter"可进行快捷提交,评论支持部分 Markdown 语法:[link](http://example.com) _italic_ **bold** `code`。
< > 分享
分享您的问题
所有回答(2) 0 你这个是JS代码缺少一个对response的内容添加到html节点的操作吧
比如$(".more2").html("服务端返回的html代码片段"); 西越泽 | 园豆:10633 (专家六级) | 2019-04-08 17:22 编辑文本 预览 上传图片
Ctrl+Enter键快速提交 0 应该是这里有问题:
$(function () {
$.get(
"${pageContext.request.contextPath}/category/findAll.do",
{},
function () { })
})
这里边的callback函数和返回值类型都没有写,自然也就对你findAll没有反应了。 须弥shan | 园豆:224 (菜鸟二级) | 2019-04-08 22:09 编辑文本 预览 上传图片
Ctrl+Enter键快速提交
清除回答草稿
您需要 登录 以后才能回答,未注册用户请先 注册 。

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行