I am confused in using either of this. In my case when ResultSet found I redirect to NoRecords.jsp else MainMenuDsp.jsp. But I make sure that all Database related objects con,stmt,rs get closed before forward action. But still doubts whether closing conn take place properly. I favoured forward just becuase it seems to be faster than sendRedirect... Pls comment
Joined: Nov 06, 2000
It depends on what you are trying to achieve. SendRedirect actutally sends a response back to the client after which the client is taken to the specified URL. The request object is no longer available then. Forward passes on the request to the destination page. You can search this and the Servlets forum for more info.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Joined: Dec 06, 2000
Hi Sandhya, when you do a forward from a servlet the URI will not change. I had a situation where I have a top.jsp which has some buttons and graphics included in every pages of my project. So when I forward from one servlet to a jsp page because the URI does not change the top part of the jsp page did not displayed properly. (The grphics does not load, only text loads correctly). So I had to change it to redirect. forward will take you directly to the forwarded page where as redirect will redirect back to client and send another query for the redirected page. speeeed mmmmm may be. Nasser