response.sendRedirect() from Servlet to JSP does not seem to work

前端 未结 4 413
滥情空心
滥情空心 2020-12-11 14:59

I am writing a client server program. I am sending an arraylist from an android phone and I am able to receive the list also. After that I want the servlet to redirect to

4条回答
  •  悲哀的现实
    2020-12-11 15:18

    Instead of using

    response.sendRedirect("/demo.jsp");
    

    Which does a permanent redirect to an absolute URL path,

    Rather use RequestDispatcher. Example:

    RequestDispatcher dispatcher = request.getRequestDispatcher("demo.jsp");
    dispatcher.forward(request, response);
    

提交回复
热议问题