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");

你可能感兴趣的:(Ajax,Webwork)