ApplicationDispatcher exception

Posted by JFB on Stack Overflow See other posts from Stack Overflow or by JFB
Published on 2012-07-02T16:44:45Z Indexed on 2012/07/09 3:16 UTC
Read the original article Hit count: 181

Filed under:
|

Whenever I try to redirect to a certain page using this dispatch method that is called from my doGet method, I get the following exception. I have no idea why!

account controller servlet

protected void dispatch(HttpServletRequest request,
            HttpServletResponse response, String page)
            throws javax.servlet.ServletException, java.io.IOException {
        RequestDispatcher dispatcher = getServletContext()
                .getRequestDispatcher(page);
        try {
            dispatcher.forward(request, response);
        } catch (java.lang.NullPointerException e) {
            System.out.println("NullPointerException: attribute expected in view");
        }
    }

Error msg

    java.lang.NullPointerException
        org.apache.jasper.JasperException: java.lang.NullPointerException
        org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        controller.AccountController.dispatch(AccountController.java:91)
        controller.AccountController.doExecute(AccountController.java:72)
        controller.AccountController.doGet(AccountController.java:34)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    java.lang.NullPointerException
        org.apache.jsp.content.edit_jsp._jspService(edit_jsp.java:109)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        controller.AccountController.dispatch(AccountController.java:91)
        controller.AccountController.doExecute(AccountController.java:72)
        controller.AccountController.doGet(AccountController.java:34)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

© Stack Overflow or respective owner

Related posts about java

Related posts about servlets