日期:2014-05-16  浏览次数:20425 次

Ext doAction提交json参数后台接收为乱码解决方案

在websphere服务器上,客户端提交json代码,后台接收为中文字母为乱码,为这个问题没少查阅资料,在参考对比Ext.Ajax.request方法时,豁然发现传递json参数方式有问题,细微差别,导出出现不同的问题,详细代码如下:

loginForm.form.doAction('submit',{
?????????????????????????????????????????? url:'purchaseApplyToOrder.do',
??????????????????????????????????????????? method:'post',
????????????????????????????????????????//??? params:'json='+json,??//错误提交json参数,导致后台接收中文字母为乱码
??????????????????????????????????????????? params:{json:json},???//正确提交json参数
??????????????????????????????????????????? timeout: 999999999999999999,
??????????????????????????????????????????? waitMsg:'正在提交......',
??????????????????????????????????????????? waitTitle :'等待',
??????????????????????????????????????????? success:function(form,actionReturned){
???????????? Ext.MessageBox.alert('信息提示',"成功,申请编号:"+actionReturned.result.successful,function(){
??????????????????????????????????? ????? ????? parent.parent.search();
???????????????????????????????????????????????????????? parent.parent.win.close();
??????????????? ?
???????????????????????????????????????????????????? });
???????????? this.disabled=true;
???????????????????????????? },
?????????????????????????????????? ???failure:function(form, actionReturned){
?????????????????????????????????? ???? if(actionReturned.result!=null){
????????????? Ext.MessageBox.alert('信息提示',actionReturned.result.error,function(){
??????????????????????????????????? ????? ????? parent.parent.search();
???????????????????????????????????????????????????????? parent.parent.win.close();
??????????????? ?
???????????????????????????????????????????????????? });
???????????????????????????????????????????? ?}else{?
??????????????????????????????????? ????? ? Ext.MessageBox.alert('信息提示','请求超时,请刷新!',function(){
??????????????????????????????????? ????? ????? parent.parent.search();
???????????????????????????????????????????????????????? parent.parent.win.close();
??????????????? ?
???????????????????????????????????????????????????? });
????????????????????????????????????????????? ?this.disabled=false;
????????????????????????????????????????????? ?
???????????????????????????????????????? ?? }
???????????????????????????????????????? ?}
??????????????????? ???? })