Problem: when I execute above programme, if I enter wrong data or null data: It generates: [Servlet Error]-[MessageCenterLoginServlet]: java.lang.IllegalStateException: Cannot forward. Response already committed. (Servlet 2.3, SRV 8.4) ************** I believe if it is going in 1 loop and execute forward(), it should pass control to jsp page and should not execute further. But it continues and execute remaining statements too.

Originally posted by Harpreet Hira: The forwarded request will NOT come back.

That is not correct. Of course it will return. Whether the reponse is committed or not has no effect on the semantics of the Java language. Servlets are Java classes like any other and, unless an exception is thrown, any calls will return to the caller.

What is true is that a forward call is almost always immediately followed by a return so that no code that might trigger an IllegalStateException will execute after the forward and the committing of the response. [ June 09, 2006: Message edited by: Bear Bibeault ]