`
happy100583
  • 浏览: 122162 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

js 传递中文参数 至 action 乱码问题

阅读更多

 

前台js:

 

function ajaxClick(sortName) {
  var tempName = encodeURI(encodeURI(sortName)) //进行两次编码
  URL = "ttrialCharts.action?sortName="+ tempName +"&nocash="+new Date().getTime();
  alert(URL);
   new Ajax.Request(URL, {
   method: 'POST',
   onSuccess: function(transport) {
    var returnInfo = transport.responseText;
         
      }
   });
 }

 

 

action后台(webwork):

String sortName = ServletActionContext.getRequest().getParameter("sortName");       
  sortName = URLDecoder.decode(sortName, "UTF-8");

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics