struts2+ajax 一直error,求解
jsp代码:$.ajax({url:deleteAction,type:'POST',dataType:'string',error:function(){alert('...
jsp代码:$.ajax({
url: deleteAction,
type: 'POST',
dataType: 'string',
error: function(){alert('删除失败!');},
success: function(result){
deleteRow(tbs,deleteLine);
}
});
action代码:public String execute(){
jijinService.deleteGudongTuantiMingdan(actionType,bianHao);
HttpServletResponse response = ServletActionContext.getResponse();
try {
response.setContentType("text/html; charset=UTF-8");
response.getWriter().write("success!");
} catch (IOException e) {
e.printStackTrace();
}
return SUCCESS;
}
struts配置文件:<action name="gudongDelete" class="com.cn.DeleteAction">
<result name="success" type="null">
</result>
</action>
后台代码debug都通过了,就是到前台后,一直执行error的方法,求解!!!!
struts配置文件:<action name="gudongDelete" class="com.cn.DeleteAction">
<result name="success">
</result>
</action> 展开
url: deleteAction,
type: 'POST',
dataType: 'string',
error: function(){alert('删除失败!');},
success: function(result){
deleteRow(tbs,deleteLine);
}
});
action代码:public String execute(){
jijinService.deleteGudongTuantiMingdan(actionType,bianHao);
HttpServletResponse response = ServletActionContext.getResponse();
try {
response.setContentType("text/html; charset=UTF-8");
response.getWriter().write("success!");
} catch (IOException e) {
e.printStackTrace();
}
return SUCCESS;
}
struts配置文件:<action name="gudongDelete" class="com.cn.DeleteAction">
<result name="success" type="null">
</result>
</action>
后台代码debug都通过了,就是到前台后,一直执行error的方法,求解!!!!
struts配置文件:<action name="gudongDelete" class="com.cn.DeleteAction">
<result name="success">
</result>
</action> 展开
4个回答
展开全部
把Action里的 return SUCCESS; 改成 return null; 就行了。另外配置文件<result name="success" type="null">这个没有必要写了。
追问
谢谢,正解
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
response.setContentType("text/json; charset=UTF-8");
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
return null
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询