当前位置: 首页 > 知识库问答 >
问题:

HTTP状态500-java.lang.NumberFormatException:空

赵星华
2023-03-14
HTTP Status 500 - java.lang.NumberFormatException: null

type Exception report

message java.lang.NumberFormatException: null

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.NumberFormatException: null
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    com.filter.RequestFilter.doFilter(RequestFilter.java:107)

root cause

java.lang.NumberFormatException: null
    java.lang.Integer.parseInt(Unknown Source)
    java.lang.Integer.parseInt(Unknown Source)
    org.apache.jsp.WEB_002dINF.add_jsp._jspService(add_jsp.java:139)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    com.filter.RequestFilter.doFilter(RequestFilter.java:107)
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    // TODO Auto-generated method stub
    // place your code here
    boolean flag = true;
    HttpServletRequest httpServletRequest = (HttpServletRequest) request;
    HttpServletResponse httpResponse = (HttpServletResponse) response;
    httpServletRequest.getServletPath();
    System.out.println(httpServletRequest.getServletPath());


    String address = InetAddress.getLocalHost().getHostAddress();
    System.out.println(address); 


    // For the first time (Welcome page) i will be 0 so that it will perform first if

    if(i == 0)
    {
        System.out.println(i);
        if(verify(address))
        {
            chain.doFilter(request, response);
            i++;
        }

        else
        {
            RequestDispatcher requestDispatcher = httpServletRequest.getServletContext().getRequestDispatcher("/WEB-INF/forbidden.jsp");
            requestDispatcher.forward(request, response);
            return;
        }

    }

    // For the second time (Controller) i will be 1 so that it will perform first if


    else if(i == 1)
    {
        System.out.println(i);
        i++;
        System.out.println("after ++"+i);
        chain.doFilter(request, response);
    }

    // For the second time (add page) i will be 2 so that it will perform first if


    else if(i == 2)
    {

        if(specialChara(httpServletRequest))
            {
                System.out.println(i);
                System.out.println("done");
                i++;
                chain.doFilter(request, response);
            }

            else
            {
                System.out.println(i);
                flag = false;
                System.out.println(""+httpServletRequest.toString()+ "\n"+httpResponse.toString());
                RequestDispatcher requestDispatcher = httpServletRequest.getServletContext().getRequestDispatcher("/WEB-INF/add.jsp");
                requestDispatcher.forward(request, response);

            }
    }

    // For the third time (Controller) i will be 2 so that it will perform first if

    else if(i == 3)
    {
        System.out.println(i);
        i++;
        chain.doFilter(request, response);
        i = 0;
    }

共有1个答案

曹自怡
2023-03-14
int no = Integer.parseInt(request.getParameter("no"));
 类似资料:
  • 我遇到了从html向servlet提交数据的问题 消息为空 说明服务器遇到意外情况,无法完成请求。 例外情况 注意服务器日志中提供了根本原因的完整堆栈跟踪。

  • 我的资源 index.jsp HTTP状态500-servlet Jersey Web应用程序的servlet.init()引发异常 类型异常报告 servlet Jersey Web应用程序的消息servlet.init()引发异常 Apache Tomcat/8.0.43

  • 好的,我在运行我的应用程序时遇到了这个问题,我相信这是因为版本控制。 秋季开始,我使用Tomcat 9.0.4。我使用最新的JavaSDK。 现在,我使用的是Spring版本5.0.2。 这是我的pom。xml: 这是我的web.xml: 这是我的调度器servlet。xml: 现在,我想提一件事:看看那些?我不确定这是否正确。为什么?这就是我在输出中得到的错误: 现在,我知道这是一大段文字,你可

  • 我正在用java web JSP Struts 1编写我的第一个helloworld web项目。我已经尽力修复这个HTTP状态500错误。任何帮助都将不胜感激。以下是我的githud代码来源:https://github.com/paeltc/Struts1Demo1. 这是我得到的回应: 我使用的是阿帕奇雄猫/9.0.27

  • PS:我知道用jsp编码java是不好的... 类型异常报告 消息处理JSP页面/assets/JSP/create-dest-code.JSP第35行时发生异常 说明服务器遇到内部错误,导致它无法完成此请求。 exception org.apache.jasper.jasperException:在处理JSP页面/assets/JSP/create-dest-code.JSP第35行时发生异常

  • 当我显示客户的ID时,我会得到错误消息。我也试图更改属性'id'的名称,但出现了相同的错误与新名称。 HTTP状态500-内部服务器错误 类型异常报告消息内部服务器错误描述服务器遇到内部错误,导致它无法完成此请求。 异常org.apache.jasper.jasperException:javax.el.PropertyNotFoundException:类“de.java2Enterprise.