一个小问题!
我想利用forward方法实现一个页面的跳转,写了如下的代码,page是指需要跳转的页面,public void forward(WebController servlet, HttpServletRequest request,
HttpServletResponse response, String page) throws ServletException {
try {
ServletContext ctx = servlet.getServletContext();
RequestDispatcher dispatcher = ctx.getRequestDispatcher(page);
if (dispatcher == null) {
throw new RuntimeException("NO dispatcher found for" + page);
} else
dispatcher.forward(request, response);//利用断点调式dispatcher一切正确,但就是不能跳转到我需要的页面,说页面不可用,那位大虾给讲讲是怎么回事!
} catch (Exception e) {
e.printStackTrace();
throw new ServletException("Failed to process request", e);
}
}