1

I have come across these two statements on an interview question on the web:

 1.forward causes object stored in request as attributes to be lost;
 2.sendRedirect causes object stored in request as attributes to be lost;

I am now confident that the first statement is wrong since using request is definitely how forward works to pass values, but I am confused about the sendRedirect one, is it correct in this sense? Could experts help? Thanks.

Kevin
  • 6,711
  • 16
  • 60
  • 107

1 Answers1

4

Unlike forward which happens on the server-side, sendRedirect causes the browser to initiate a new request to the redirect location, which means the second statement is true.

Sébastien Le Callonnec
  • 26,254
  • 8
  • 67
  • 80