Originally posted by Kalai Selvan:
Looking at the two lines of ur code, it should not give any error. But if u have any out.println() in ur code, i.e if ur writing something to the response body and then redirecting will not work. So please post the full code, tht will make the problem more clear.
Precisely. If, after you have set the content type for your response object and have already attempted to write something out to the client, and then, you try to use the sendRedirect( ) method, it will not work. Its better if you could please post your full code so that we can take a look at what you are trying to do.