
正文
jsp页面传中文到后台乱码怎么办?
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
一般从前台传值到后腰如果传的值是中文的话,又不用post传值方式,到后台显示会显示成乱码的形式。所以以下方法亲测有效防止乱码。
前台jsp页面:
var taskTitle = $('#taskTitle').val();
location.href = "${ctx}/monthplan/monthWorkPlanAction!addMonthWorkPlan.action?taskTitle="+encodeURIComponent(taskTitle)
后台action接收方法:
String obj =new String(getRequest().getParameter("taskTitle").getBytes("ISO8859-1"),"UTF-8");






