This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

HTML Frames / Applet / Servlet and Session Tracking - Help with Strategy Please  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
David Edelstein
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured it out and it works just as I described.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!