int page=Integer.valueOf(p);
int rows=Integer.valueOf(r);
以下是出错信息: java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:417)
at java.lang.Integer.valueOf(Integer.java:554)
at tk.tangchao.servlet.JsonGenerate.doPost(JsonGenerate.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
at java.lang.Thread.run(Thread.java:619)
javawebeasyUIStingintj2ee
------解决方案-------------------- 用parseInt()试试。
int page = Integer.parseInt(p);
int row = Integer.parseInt(r); ------解决方案-------------------- java.lang.NumberFormatException: null
已经提示你了,你传入的是null,而null是不能被转为int的 ------解决方案-------------------- 异常提示的很清楚,你传入方法的Integer.valueOf的字符串==null ------解决方案--------------------
if(null!=p&&!"".equals(p)){
int page=Integer.valueOf(p);
}
if(null!=r&&!"".equals(r)){
int rows=Integer.valueOf(r);
}
判断下就好,看下api里面的异常说明就明白了,不为空转换