javaweb网上书店之分页技术---有get方法进行查询分页,而URL中包含"%"的出错处理

 警告: Parameters: Character decoding failed. Parameter skipped.
java.io.CharConversionException: isHexDigit
 at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:88)
 at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:49)
 at org.apache.tomcat.util.http.Parameters.urlDecode(Parameters.java:410)
 at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:392)
 at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:508)
 at org.apache.tomcat.util.http.Parameters.handleQueryParameters(Parameters.java:266)
 at org.apache.catalina.connector.Request.parseParameters(Request.java:2421)
 at org.apache.catalina.connector.Request.getParameter(Request.java:1040)
 at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:355)
 at com.weiyi.book.servlet.admin.PagingServlet.doPost(PagingServlet.java:62)
 at com.weiyi.book.servlet.admin.PagingServlet.doGet(PagingServlet.java:41)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at com.weiyi.book.filter.EncodingFilter.doFilter(EncodingFilter.java:31)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:619)

引起的原因:有get方法进行查询分页,而URL中包含"%"

解决:只要URL中出现%,日志里都会记载这个错误。在一些搜索引擎中查询‘%’时,发现他们都被替换成%25。。。囧·····

   strNew=str..replace(/\%/g,'%25');//str=str.replace('%','%25');只能替换第一个%
    var url = "Servlet?str="+strNew;

 


原文链接: http://blog.csdn.net/weiyirong/article/details/7089784

你可能感兴趣的:(javaweb网上书店之分页技术---有get方法进行查询分页,而URL中包含"%"的出错处理)