页面到action乱码,其中数据库编码,页面编码,tomcat编码都已经为UTF-8
所有页面查询中传入的参数,需要对参数进行encodeURI,不然中文传到后台action会出现中文乱码,不能查询
例如:/STDWX/jsp/stdBook/stdBookForm/bookFormQuery.jsp
<script type="text/javascript">
function processQuery(){
var name = document.getElementById('standardBook.name').value;
name = name.replace(/^\s+|\s+$/g,"");
var sort=document.getElementById('standardBook.sort').value;
var mill=(parseInt(Math.random()*10000)).toString();
var params='&standardBook.name=' + name +'&standardBook.sort='+sort;
var url = 'stdBook/stdBookpartAction.action?currentTimeSerial='+mill;
var params1=encodeURI(params);
url=url+params1;
$('#context').load(url);
}
</script>
请各位将所有query页面加上 encodeURI()
对参数转码
例如:/STDWX/jsp/stdBook/stdBookForm/bookFormQuery.jsp
<script type="text/javascript">
function processQuery(){
var name = document.getElementById('standardBook.name').value;
name = name.replace(/^\s+|\s+$/g,"");
var sort=document.getElementById('standardBook.sort').value;
var mill=(parseInt(Math.random()*10000)).toString();
var params='&standardBook.name=' + name +'&standardBook.sort='+sort;
var url = 'stdBook/stdBookpartAction.action?currentTimeSerial='+mill;
var params1=encodeURI(params);
url=url+params1;
$('#context').load(url);
}
</script>
请各位将所有query页面加上 encodeURI()
对参数转码