使用URLDecoder.encode和URLDecoder.decode方法转码:
jsp encode 方法只支持在js中使用
<script>
function click_encodeLink(customerName){
alert(customerName)
location.href = “${ctx}/projectmanage/gcProject/getList?customerName=” + encodeURI(encodeURI(customerName)) ;
}
</script>
A标签调用js就OK了
<a class=”menu”
href=”javascript:click_encodeLink(‘${customerInfo.customerName}’)”
target=”mainFrameName”><span>工程信息</span> </a>
后台接受值转码,OK
String name=java.net.URLDecoder.decode(gcProject.getCustomerName(), “UTF-8”);