submitHandler:function() {
   var param="\"typeName="+$("#typeName").attr("value")+"\"";
   $.ajax({
        type: "POST",
        url:"${pageScope.basePath}add_type", 
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        data:params,
        success: function(data,textStatus){
         //alert(data);

                },
                error : function(XMLHttpRequest, textStatus, errorThrown){
                        alert("服务器出错,请稍候再进行登录");
                    },
                    complete : function(XMLHttpRequest, textStatus){
                      $("#typeName").attr("value","");
$("#typeName").attr("value","");
                    }      
   });       }这个是jquery的代码。问题描述:数据成功提交了,可是返回的数据直接把原来的页面刷掉了。
我也怀疑是action返回的数据类型没设置成json数据引起的问题。可是其他的ajax提交数据都是正常的。下面的action的部分代码:
String str=gson.toJson(testMap);
HttpServletResponse response = ServletActionContext.getResponse();   
        response.setContentType("application/json;charset=UTF-8");
        response.setHeader("cache-control","no-cache");
        try {
PrintWriter out = response.getWriter();
out.print(str);
        out.flush();
        out.close();
} catch (IOException e) {
e.printStackTrace();
}
return null;