1.action类引入struts2的"json-default"拦截器栈

@ParentPackage("json-default")
//示例 @ParentPackage(WapBaseAction.WAP_PACKAGE)
//WAP_PACKAGE继承了json-default @Namespace("/") public class ModifyResumeAction extends WapBaseAction {...

2.@Action的result类型为json同时可以设置params

@Action(value = "creatResume", results = {@Result(name = JSON,type=JSON, params={ROOT,RESULT})})

3.jquery序列化form表单使用ajax提交

$.ajax({
      url: "<eiss:site site="WAP_CENTER"/>/creatResume",
      data: $("form").serialize(),   //序列化form表单
      type: "POST",
      dataType: "json",
      success: function(result){      //result为返回json数据
         $.alert(result.message,function() {
             window.location.href = "<eiss:site site="WAP_CENTER"/>/myResumes";
             });
      }
  });
});

 

posted on 2015-01-09 17:18  Eidison186  阅读(906)  评论(0编辑  收藏  举报