我正在尝试从 servlet 使用中获得响应
request.setAttribute(error, error);
request.getRequestDispatcher("http://localhost:8080/redicted_test/Home.jsp").forward(request, response);
String redictedURL="http://localhost:8080/redicted_test/Home.jsp";
response.sendRedirect(redictedURL);
但得到错误
java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
我知道我发送了两次回复,但我该怎么做呢?你能告诉我最简单的方法吗?