This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I have a question regarding the forward method of request dispatcher. I know the difference between forward and sendredirect but what i'm not able to understand is why the browser behaves quirky when i click on back button. So here is what I have.
1. A page foo.jsp is displayed to the user which has links and a text box and a submit button. The form action is /foo.do (Yes its struts but my question is not related to struts).Its a post request.
Now bar.jsp is displayed and my address bar is still at /foo.do which is correct since its a server side forward. Now when I click on back button in bar.jsp nothing is happening, the same page (bar.jsp) is displayed again, i can't even say its loaded again because the page is not refreshed, its just like the back button is not working and its not sending any request to the server because I monitor the server after clicking on the back button and there are no activity. I don't have cache prevention headers in my response, so I'm assuming the browser has cached bar.jsp and foo.jsp but why is not going back to foo.jsp when i click on back button ?
Second question -> While in bar.jsp if i press F5 i get a pop up saying the information must be resubmitted, now I'm confused if the page is cached why is it requesting the server again ?
Third question --> Will browsers cache post requests by default if we don't have cache control headers in the response ?