当前位置: 代码迷 >> J2EE >> 为甚麽小弟我用request.getRequestDispatcher获得Nullpointer
  详细解决方案

为甚麽小弟我用request.getRequestDispatcher获得Nullpointer

热度:180   发布时间:2016-04-22 02:53:50.0
为甚麽我用request.getRequestDispatcher获得Nullpointer
request.getRequestDispatcher("index"+".jsp").forward(request,response);

严重: Servlet.service() for servlet [jsp] in context with path [/twitter3] threw exception [java.lang.NullPointerException] with root cause
java.lang.NullPointerException
at org.apache.jsp.test_jsp._jspService(test_jsp.java:94)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

改成

<jsp:forward page="index.jsp"/>就好啦

------解决方案--------------------
楼主什么意思
是问问题吗
------解决方案--------------------
LZ看下response.sendRedirect()和request.getRequestDispatcher().forwar(request,response)的区别
  相关解决方案