This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to disable cookies through programming  RSS feed

 
Himanshu Bisht
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i am making a database application in jsp/servlets which included online accessing and entering the data into tables.I am afraid that once the user submit the values he can go back and if re submits the page then the database will give errors.
I have to put all the checks at the user side itself so is there anyway through which i can show the message that "THE PAGE HAS EXPIRED" whenever the user navigates backwards.
I think i can be done by disabling cookies so that no files are stored in temperory folder.
thanks in advance
himanshu
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This problem has nothing to do with cookies...

Please read the last post in this thread (Avoid submission of form multiple times), that describes the correct way to prevent multiple form submissions.

(N.Pruett - fixed link.)
[ September 23, 2004: Message edited by: Nathan Pruett ]
 
Himanshu Bisht
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks mate!!!

but the solution is not working!!!I tried it but it is still taking you back and you can click the submit button again.
Well i want something like once the page is viewed you caanot go back to the submit page.Is it possible to do it in jsp???

Thanks again
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can go back and click the submit button again, but the full request should not go through if you're using the "synchronizer token pattern" discussed in the referenced post.

If you really don't want to render the page again, you could change the procedure a bit - set the token in the session in the page before the form page, check for the token in the form page - if it's there show the form and remove the token, else show an error page. You also need to ensure that you turn off caching for the page so the browser makes a new request every time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!