Reason: By the way of the parameter stitching, the Chinese will be converted into UTF-8 code for transmission
Workaround: Change to post parameter
Original code:
function_search () {varRoleinformation = $ (' #TOrhChkErrExamineTable '); Roleinformation.datagrid ({pagenumber:1,url:projectpath+ ' torhchkerrcontroller/findall.do?permissioncode=torgchkerrexaminesearchcode& ' +$ (' # Torhchkerrexamineform '). Serialize (), Onloaderror:function(data) {if(data.statustext== ' Forbidden ') {Showbo.Msg.alert (' Sorry, your authentication has expired! ‘); Window.top.location.href=projectpath+ "Logincontroller/login.do"; } }}); $(' #TOrhChkErrExamineTable '). DataGrid (' Clearselections ');}
Solution Solutions
1. Create a section of JS code to convert form form parameters to JSON format strings
$.fn.serializeobject =function () { varo = {}; varA = This. Serializearray (); $.each (A,function () { if(o[ This. Name]) { if(!o[ This. Name].push) {o[ This. name] = [o[ This. Name]]; } o[ This. Name].push ( This. value | | ‘‘); } Else{o[ This. Name] = This. value | | ‘‘; } }); returno;};
3, modify the original method of the way of the transfer of parameters. Key: In the Queryparams parameter
function_search () {varTorhchkeeinformation = $ (' #TOrhChkErrExamineTable '); if($ (' #TOrhChkErrExamineForm '). Form (' Validate ')) {Torhchkeeinformation.datagrid ({pagenumber:1, Url:projectpath+ ' Torhchkerrcontroller/findall.do?permissioncode=torgchkerrexaminesearchcode ', Queryparams: $ (' #TOrhChkErrExamineForm '). SerializeObject (), Onloaderror:function(r) {if(R.statustext = = ' Forbidden ') { if(R.responsetext! =NULL&& r.responsetext!= "") {Showbo.Msg.alert (r.responsetext); } Else{Showbo.Msg.alert (' Sorry, your authentication has expired! ‘); Window.top.location.href= ProjectPath + "Logincontroller/login.do"; } } }});}Else{Showbo.Msg.alert (' Query criteria cannot contain sensitive characters '); }}
After the form is filled in Chinese, the UTF-8 code is uploaded to the background, causing the query to fail.