qq_28573739 2016-08-14 10:51 采纳率: 100%
浏览 893
已采纳

easyui+springMVC显示列表问题!

前台:

 <table id="dg" title="My Users" class="easyui-datagrid" style="width:550px;height:250px"
url="regist.do"
toolbar="#toolbar"
rownumbers="true" fitColumns="true" singleSelect="true">
<thead>
<tr>
<th field="username" width="50">First Name</th>
<th field="lastname" width="50">Last Name</th>
<th field="phone" width="50">Phone</th>
<th field="email" width="50">Email</th>
</tr>
</thead>
</table>
后台

@RequestMapping(value = "regist", method = RequestMethod.POST)
public Object regist(HttpServletRequest request, User user) throws Exception {
    List<User>  userList=   userService.getUsers();
    System.out.println(userList);
    Map<String, Object> result = new HashMap<String, Object>(2) ; 
    JSONArray arr = new JSONArray();
    JSONObject obj = new JSONObject();
    for(int i =0;i<userList.size();i++){
    obj.put("username", userList.get(i).getUsername());
    arr.add(obj);
    }
    result.put("total",userList.size() );
    result.put("rows", arr);
    return JSONObject.fromObject(result);
}

debugger跳进regist方法里了 但是浏览器报jquery-1.7.2.min.js:4 POST http://localhost:8080/SpringMVC/regist.do
没找到这个方法??在问一下spring怎么返回才能把数据加载到表格里

  • 写回答

1条回答

  • zqbnqsdsmd 2017-02-22 15:56
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 已采纳回答 11月29日

悬赏问题

  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3