メソッドから呼び出されるこのディスパッチメソッドを使用して特定のページにリダイレクトしようとするとdoGet
、次の例外が発生します。理由がわかりません!
アカウントコントローラサーブレット
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");
}
}
エラーメッセージ
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)