2013-1-16 10:35:49 org.apache.tomcat.util.http.Parameters ProcessParameters
Warning: Parameters:character decoding failed. Parameter ' id ' with value '%u8ba2%u5355 ' has been ignored. The "name" and "value" quoted here is corrupted due to the failed decoding. Use debug level logging to the original, non-corrupted values.
Enter Servlet Get Method ...
Ok:
2013-1-16 10:35:49 Org.apache.catalina.core.StandardWrapperValve Invoke
Serious: Servlet.service () for Servlet suggest threw exception
Java.lang.NullPointerException
At Com.ont.demo.suggest.doGet (suggest.java:25)
At Javax.servlet.http.HttpServlet.service (httpservlet.java:617)
At Javax.servlet.http.HttpServlet.service (httpservlet.java:717)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:290)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:206)
At Org.apache.catalina.core.StandardWrapperValve.invoke (standardwrappervalve.java:233)
At Org.apache.catalina.core.StandardContextValve.invoke (standardcontextvalve.java:191)
At Org.apache.catalina.core.StandardHostValve.invoke (standardhostvalve.java:127)
At Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:102)
At Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:109)
At Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:298)
At Org.apache.coyote.http11.Http11Processor.process (http11processor.java:852)
At Org.apache.coyote.http11.http11protocol$http11connectionhandler.process (http11protocol.java:588)
At Org.apache.tomcat.util.net.jioendpoint$worker.run (jioendpoint.java:489)
At Java.lang.Thread.run (thread.java:619)
Solving Method: In the transfer of parameters before the Chinese parameters are encoded two times, JSP page to obtain parameters for the Chinese parameters of a decoding, Chinese parameters will not become garbled!
Reference Examples:
Copy Code code as follows:
<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "
pageencoding= "UTF-8"%>
<%@ page import= "java.net.*"%>
<%
String str0= "";
String str1= "";
if (Request.getparameter ("Param0")!=null) {
Str0=request.getparameter ("Param0")/Direct access to Chinese parameters
}
try{
if (Request.getparameter ("param1")!=null) {
Str1=urldecoder.decode (Request.getparameter ("param1"), "utf-8")//decoding of Chinese parameters
}
}catch (Exception e) {
E.printstacktrace ();
}
%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<script type= "Text/javascript" >
var str= "Hello";
function Test0 () {
window.location= "test.jsp?param0=" +str;//directly transfer Chinese parameters
}
function Test1 () {
window.location= "test.jsp?param1=" +encodeuri (encodeURI (str))//two-layer encoding of Chinese parameters before transmission
}
</script>
<body>
<input VALUE=<%=STR0%>>
<input type= "button" value= "garbled" onclick= "test0 ()" ><br>
<input VALUE=<%=STR1%>>
<input type= "button" value= "normal" onclick= "test1 ()" >
</body>