So sánh RequestDispatcher.forward() và response.sendRedirect(), phát biểu nào đúng?
Xem đáp án và giải thích
Forward: một request, xử lý nội bộ, chỉ trong cùng ứng dụng, giữ attribute. Redirect: hai request, browser thấy URL mới, có thể sang domain khác, mất request attribute. Sau khi xử lý POST nên dùng redirect (Post/Redirect/Get) để tránh submit lại khi F5.