servlet中request.getRequestDispatcher("index.jsp")跳转到jsp页面没有任何反应
目的想要在servlet中跳转到jsp页面上。
index.jsp页面在根目录上,没有出现404错误。
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String path = "/index.jsp";
List<Books> all = null;
try{
all = DaoFactory.getIBookDaoInstance().findAll(" ");
}catch(Exception e){
e.printStackTrace();
}finally{
}
System.out.println("dd");
request.setAttribute("books", all);
request.getRequestDispatcher("/index.jsp").forward(request, response);
System.out.println("dd");
}
request.getRequestDispatcher("/index.jsp").forward(request, response);