Web tier: servlets, JSP, Web frameworks: Same action is posted - Browser's Refresh Button

  1. Hello,

    We have JSP pages, all JSP pages some action button, lets say, Proceed, Add New Customer, Lock Payment, etc.

    When user performs one action, it does well, but when the Refresh button is pressed, the same action is taken again.

    My openion: In our case, all our action goes to center servlets named "MainServlet". What I want here, any time, MainServlet gets a request, the request should be checked that this should not be the request what is just received before. In shortly, How do I differntiate 2 request?

    any comments,

  2. Hi
     You can put the userid in session and later checking that id expire the previous page both from the cache and the web server.
  3. It kind of depends on the context of "same action". You can bind the request object to the usersession when the user proceeds from one page to the next, hits reload, etc...-- any service action, basically. Whatever you want to compare (such as form input) that makes two request objects equivalent can be checked to see if the current request object is the same as the request object bound to the session-- in other words, the last request object produced in the user's session.