JSP页面向后台传递数据乱码问题解决方案

前台jsp中:

var groupBuyerName = document.getElementById('groupBuyerName').value;
groupBuyerName = encodeURI(encodeURI(groupBuyerName));

后台java类中:

String groupBuyerName = request.getParameter("groupBuyerName")
groupBuyerName=URLDecoder.decode(groupBuyerName,"utf-8");

 

Struts2配置文件中添加:

你可能感兴趣的:(Java,Web)