First of all, you can't call sendRedirect()
, after you have already used forward()
. So, you get that exception.
However, it seems like the use of sendRedirect()
there is really not needed. You seem to be believing that you need to use sendRedirect()
after forward()
, since you have used the same page in both of them. Actually, it's not like that.
Simply remove the sendRedirect
line, and you'll be fine.
See also: