I have an HTML page broken up into two frames. In one frame I have an applet with a graphical slider and a submit button. The slider increments an integer (int rating) from 0-100. When the submit button is pressed the applet sends the rating the slider was set at (in String format) as a parameter within a post method to a servlet with the target of the servlet being the other frame on the same HTML page. The servlet reads the parameters from the post request thus getting the rating that was submited. It works beautifuly and is cool because the applet doesn't have to reload everytime the submit button is pressed. My problem is that if refresh is pressed within the browser, the servlet gets the same post request sent to it again. I need to set something up similar to a tokenizer pattern that will only allow the servlet to do its thing if it is a true new post from the applet and not just a refresh request. I was thinking to maybe get the current time in the applet when the submit button is pressed store it as a parameter and sending it along with the rating value to the servlet. The servlet could store the time from the applet post in a session of the servlet and then only process the request if the time stored in the session does not equal the parameter assigned from the applet submission. Do you have any better ideas? How would I get the time from an applet object? Thanks for your input!
posted 16 years ago
I figured it out and it works just as I described.