首页 > 编程语言 > 详细

SpringMVC配置easyui-datagrid

时间:2015-10-21 18:54:22      阅读:394      评论:0      收藏:0      [点我收藏+]

SprimgMVC的UserController.java
@RequestMapping(value = "listUserForJson")
@ResponseBody
public Object listUserForJson(){
    User user = new User();
    List<User> users = userDao.listUser(user);
    Map<String,Object> jsonMap = new HashMap<String,Object>();
    jsonMap.put("rows",users);
    jsonMap.put("total",users.size());
    Object jsonObject = JSONObject.toJSON(jsonMap);
    System.out.println(jsonObject);
    return jsonObject;
}


JSP页面配置easyui-datagrid
<body>
    <table id="dataTable" class="easyui-datagrid" style="width:400px;height:250px">
        <thead>
        <tr>
            <th data-options="field:‘id‘">ID</th>
            <th data-options="field:‘name‘">名称</th>
            <th data-options="field:‘age‘">价格</th>
        </tr>
        </thead>
    </table>
<a href="/ssm">回到首页</a>
</body>
<script>
    $(document).ready(function() {
        page_init();
    });
    function page_init() {
        $("#dataTable").datagrid({
            url: "listUserForJson",
            pagination: true,//分页控件
        });
    }
</script>

SpringMVC配置easyui-datagrid

原文:http://www.cnblogs.com/cocoat/p/4898394.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!