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

Extjs的js前台中用url动态传参到后台的汉字参数为乱码?求解决!!!
SSH+Extjs

js中:
 proxy : new Ext.data.HttpProxy({
                   
 url : "stuinfo!collection.action?id="             + Ext.getCmp('searchId').getValue()+"&stuname="+Ext.getCmp('searchStuName').getValue()

ssh框架的Action中接受到的参数打印出来为乱码

------解决方案--------------------
encodeURIComponent编码下发送的数据

 url : "stuinfo!collection.action?id="  + encodeURIComponent(Ext.getCmp('searchId').getValue())+"&stuname="+encodeURIComponent(Ext.getCmp('searchStuName').getValue())
------解决方案--------------------
value 就是你自己从前台传过来的值,String value = request.getParameter("自己传参的名字");
然后 System.out.println(URLEncoder.encode(value,"UTF-8"));试试。