前台jsp
$(document).ready(function (e) {
var json = [ ];
$.ajax({
type: "POST",
url: "findTroArticleListView",
async: false,
success: function(pagingList){
var tbody = "";
$(pagingList.returnList).each(function(index, domEle){
var trs = "";
trs += " <tr> <td> "
+ domEle.sort +" </td> <td>"
+ domEle.title +" </td> <td>"
+ domEle.content.substring(0, 30)+" </td> </tr>";
tbody += trs;
// alert(json);//[object Object],[object Object]
});
$("#project").append(tbody);
}
});
});
</script>
</head>
<body>
<table id = "project" border = "1" >
<tr >
<th style="width:100px;">文章种类</th>
<th style="width:250px;">文章标题</th>
<th style="width:250px;">文章内容</th>
</tr>
</table >
<div>
</body>
后台controller
@ResponseBody
@RequestMapping("/findTroArticleListView")
public List<ArticleEntity> findTroArticleListView(Model model,ArticleEntity art){
List<ArticleEntity> pagingList = null;
try {
pagingList = articleService.findArticleList(art);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return pagingList;
}
service
serviceImp
dao
mapper…