JSP中的数字格式异常

时间:2015-11-12 19:25:23

标签: java jsp servlets request

您好我正在使用组合框

     <form method="get"  action='create_database_1' >
           <select name="User_type">
           <option value="b">Buyer</option>
           <option value="s">Seller</option>
           </select>
      </form>

我在Servlet中收到它

public class create_database_1 extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
    {
    String User_type=request.getParameter("User_type");//Line 39
}
}

当我选择买家时,我会收到以下例外情况,同样适用于&#34;卖家&#34;。

我收到以下异常

SEVERE: Servlet.service() for servlet [create_database_1] in context with path [/Online_Auction] threw exception
java.lang.NumberFormatException: For input string: "b"
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at create_database_1.doGet(create_database_1.java:39)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

1 个答案:

答案 0 :(得分:-1)

您可以从服务器中提取.class文件并尝试对其进行反编译吗?查看堆栈跟踪,看起来第37行正在调用Integer.parseInt方法。但是看代码看起来并不那样。您正在查看的代码可能存在一些不匹配,实际部署的代码可能已部署。

如果您需要反编译器,请尝试使用Google搜索Java JD GUI ..这是我使用过的优秀反编译器之一。

如果您需要帮助找到.class文件,请告诉我您使用的服务器及其版本详细信息。