我正在尝试使用jQgrid进行内联编辑,所以我写这个:
......
colModel :[
........
{name:'idProvino', index:'idProvino', editable: true},
.......
],
onSelectRow: function(id){
if(lastsel2 != null){
$('#listCong').jqGrid('saveRow',lastsel2);
}
jQuery('#listCong').jqGrid('restoreRow',lastsel2);
jQuery('#listCong').jqGrid('editRow',id,false);
lastsel2 = id;
},
editurl: '/mywebapp/controller/update/',
这是我控制器的方法:
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public void update(@RequestParam(value="id", required=true) Long id,
@RequestParam(value="idProvino", required=true) String idProvino,
@RequestParam(value="oper", required=true) String oper,
final BindingResult bindingResult,
final Model uiModel, final HttpServletRequest httpServletRequest) {
DO SOMETHING
}
但是它没有拦截来自jQgrid的请求..为什么??
使用浏览器的ispect工具我有这个请求:
Request URL:http://localhost:8080/mywebapp/controller/update/
Request Method:POST
Status Code:200 OK
Form Data: idProvino=5869&oper=edit&id=2
答案 0 :(得分:1)
我解决了..
我的方法中有BindingResult
,但我没有任何约束,所以这就是问题....
如果我这样做的话,它会起作用:
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public void update(@RequestParam(value="id", required=true) Long id,
@RequestParam(value="idProvino", required=true) String idProvino,
@RequestParam(value="oper", required=true) String oper,final HttpServletRequest httpServletRequest) {
DO SOMETHING
}