我知道一个简单的问题,但我看不出有什么问题。我有以下代码:
String dxorderId = request.getParameter("orderid");
long orderid = Long.parseLong((dxorderId));
它位于从 PL/SQL 过程调用的 servlet 中。dxorderid 的值是从被调用页面的 URL 中的参数中检索的。因此它似乎被视为一个字符串。所以我必须将字符串转换为长字符串。但是,当我使用上面的代码时,出现以下错误:
14-Nov-2013 13:07:41 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [com.zf.proceed.service.servlets.ViewOrderServlet] in context with path [/webapp] threw exception
java.lang.NumberFormatException: null
at java.lang.Long.parseLong(Long.java:372)
at java.lang.Long.parseLong(Long.java:461)
at com.zf.proceed.service.servlets.ViewOrderServlet.doRequest(ViewOrderServlet.java:28)
at com.zf.proceed.service.servlets.ProceedBaseServlet.doRequest(ProceedBaseServlet.java:106)
at com.zf.proceed.service.servlets.ProceedBaseServlet.doGet(ProceedBaseServlet.java:39)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
我知道这意味着它不能被解析,但我不知道为什么它不能。输入的值为 1454。