1 这里是controllor层
@RequestMapping("/traceupdatestatus") 2 @ResponseBody 3 public boolean traceupdatestatus(TTask task,HttpServletRequest request){ //task对象 接受 jsp tid 和 taskstatus 4 5 boolean msg = true; 6 int count = -2; 7 try { 8 count = taskService.updateOneTaskSelectiv(task); 9 System.out.println(count); 10 } catch (Exception e) { 11 msg = false; 12 System.out.println(count); 13 e.printStackTrace(); 14 } 15 return msg; 16 }
jsp页面
1 <!-- jsp代码部分 -->
$(function(){ 2 $(".form_tracedetail_tid").click(function(){ 3 var tid = ${taskAndUser.task.tid }; 4 var taskstatus = $("#taskstatus").val(); 5 $.post('${rootPath}/task/traceupdatestatus.action', //路径 6 {tid:tid,taskstatus:taskstatus}, //json数据 7 function(msg){ 8 if(msg){ 9 alert("更改状态成功"); 10 }else{ 11 alert("更改状态失败"); 12 } 13 }, 14 "json"); 15 }) 16 })