日期:2014-05-20  浏览次数:20741 次

为甚麽我用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)的区别