`
yuanke
  • 浏览: 69706 次
  • 性别: Icon_minigender_2
  • 来自: 临沂
社区版块
存档分类
最新评论

from提交的数据到后台是乱码

    博客分类:
  • J2EE
阅读更多
请高手帮忙,在火狐浏览器插入中文没有问题,在遨游或IE就出现乱码,应该怎么解决,我
google了半天没找到
这是ext:
  //----- new a simple sendMsgPanel     --------------------创建一个发送消息的面板---------------
        var sendMsgPanel= new Ext.form.FormPanel({
            id:'1101-panel',
            title:'发送新消息',
            labelWidth:200,
            frame:true,
        //    autoHeight:true,
            buttonAlign:'center',
            items:[{
               xtype:'textfield',
               fieldLabel:'<a href="#" onclick="javascript:recivers();">接收人</a>',
               id:'reciver',
               allowBlank:false,
               width:500
            },{
               xtype:'textfield',
               fieldLabel:'标题',
               id:'caption',
               allowBlank:false,
               width:500
            },{
               xtype:'textfield',
               fieldLabel:'内容',
               id:'msg',
               allowBlank:false,
               width:500,
               height:400
            }],
            buttons:[
              {
                text:'发送',
                handler:function(){
                    var f = sendMsgPanel.getForm();
                    if(f.isValid()){
                       f.submit({
                         url:'manager.do?command=sendPersonMsg',
                      
                         success:function(form,action){
                            if(false==action.result.checkRec){
                               Ext.Msg.alert('消息',  "对不起,此用户不存在,请输入正确的用户!");
                               return;
                            }
                            if(true==action.result.insertMsgOK){  
                              Ext.Msg.alert('消息',  "发送消息成功");
                              Ext.getCmp('content-panel').layout.setActiveItem('1102-panel');  
                              recPersonStore.reload();
                            }else{
                             Ext.Msg.alert('消息',  "插入数据失败");
                            }
                         },failure:function(){
                           Ext.Msg.alert('消息',  "服务器没有连接!!");
                         }
                       });
                    }
                }
              },{
               text:'取消',
               handler:function(){
               sendMsgPanel.getForm().reset();
               }
              }
            ]
           
        });




这是后台:
}else if("sendPersonMsg".equals(command)){           
    JSONObject json= new JSONObject();
    boolean check=false;
      String title=null;
      String msg = null;

   title = (String)request.getParameter("caption");
   msg = (String)request.getParameter("msg");


  String editor = (String)request.getSession().getAttribute("who");
      String reciver = (String)request.getParameter("reciver");
    String[] name =new test3().splitName(reciver);
    try {
             for(int i=0;i<name.length;i++){
                if(name.length==1){
                 boolean checkRec = new ProcessDAO().checkRec(name[0]); //检查用户是否存在
                       if(false==checkRec){
                    json.put("checkRec", false);
                    json.put("success", true);
                    out.println(json);
                    return null;
                       }
                }
              check = new ProcessDAO().sendPersonMsg(title,msg,editor,name[i]);  
           }
   
      json.put("insertMsgOK",check);
  json.put("success",true);
        out.print(json); 
   } catch (JSONException e) {
e.printStackTrace();
}
分享到:
评论
3 楼 yefansiping 2010-03-29  
这个问题在3.0里面解决了,可是我的这块还是出现这样的问题了,郁闷
2 楼 yuanke 2008-09-02  
问题解决了,打开ext-base.js文件,
找到"application/x-www-form-urlencoded",
改成:
"application/x-www-form-urlencoded; charset=UTF-8"

其他什么都不用做,服务器自动解析成
1 楼 379548695 2008-09-02  
楼上说的不可以
应该这样处理啊
我前今天遇到的这个问题
Ext.lib.Ajax.defaultPostHeader += '; charset=utf-8';//处理ie提交中文乱码问题
这个加到onready里面就可以啦。楼主可以44看!

相关推荐

Global site tag (gtag.js) - Google Analytics