A helpful hint: Please be sure to take the time to compose descriptive subjects for your posts. You will attract people who will can give you better and faster answers when your posts have good, descriptive subjects. For more information, please click this link ⇒ UseAMeaningfulSubjectLine.
Using a title such as "I need some help" isn't going to attract the attention of those who can best help you.
You can change your subject line by clicking the button on your post.
Alfie, why are you doing a jsp:forward in your page?? Because of that your JSP page tries to do a server side forward on the request and fails as the response has already been committed to the client...
Due to some reason I kept getting database connection exceptions thrown only if the site was idle for certain time... so as remedy I was advised to handle the exception with an error page.. if I do not have the forward it will show the error page.. I did not want the people to see the error page.. instead I thought why not forward it to index page should there be an exception or error.. technically it should work.. should not it ?
Please explain what do you mean saying "response has already been committed to the client"
If the response headers and initial text created by the JSP have been sent, we say the "response has been committed" - at that point it is illegal to forward to another page and you get that exception.
To avoid this, do not send any output until you are sure you can complete the JSP page. Good design practice is to do all the database work in a servlet and only forward to a JSP page when you are sure it can be completed.
Thanks Bill That explains it all I use the JNDI connection for database and I found similar issue is faced by many others as well. but what if I just give only the forward without any response ? and should say the exception is thrown only once in a while.