前台jsp向后台Action传递String类型中文出现乱码,求解决

qqtqfs qqtqfs 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在同一项目里其他可以String传递中文到后台,页面也没问题<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
我的传递过程是:
页面写入数据: 名称: <input name="a1" id="a1" type="text" class="input150" value="" />
身份证号: <input name="a2" id="a2" type="text" class="input150" value="" />
状态: <select name="a3" id="a3" class="input100"> (注意除了中文,数字英文传递没问题,中文传到前台是乱码????之类的)
点击事件:<a href="#" onclick="searchUser()">查询</a>
function searchUser(){
var a1 = document.getElementById("a1").value;
var a2 = document.getElementById("a2").value;
var a3 = document.getElementById("a3").value;
if(a1==""&&a2==""&&a3==0){
return false;
}else{
window.location.href="<%=request.getContextPath() %>/inspection/Cgywjb_jbSsList.action?a1="+a1+"&a2="+a2+"&a3="+a3;
return true;
} }
Action:getset接收 System.out.println(a1);显示乱码,换成其他没问题
...全文
评论 10
收藏 已收藏
分享
返回顶部
qqtqfs
Web 开发 81,107 成员 341,720 内容