This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I have the following scenario: JSP page A sends a GET request to a Servlet. The Servlet carries out an operation on a database then creates a RequestDispatcher to forward() the response to JSP page B for display. The problem arises when page B is refreshed. The initial request is repeated which is not always favourable (e.g. if the request was intended to delete the last message etc). Is this standard behaviour for the RequestDispatcher? If so is there any way to control this feature so that "once-only" operations are not repeated? I'd be grateful for any help as none of the literature I've read is clear on this point. Thanks Bob
There are other things which complicate this, but in situations where a page is the result of POSTed data (as it should be, but I guess GET works too), I prefer to use response.sendRedirect rather than including or forwarding to the next page. This changes the url shown in the client browser, so that they request the display page rather than resubmitting data when they refresh the browser window. Dave