Web tier: servlets, JSP, Web frameworks: problems while refreshing
- Posted by: preeti kulkarni
- Posted on: April 20 2001 05:07 EDT
We have an online test created in JSP.When i submit my ans,i get the value of the previous checked radio buttons,by doing request.getparameter("r") where r is the name of the radio button array.
The problem is when i refresh the page the previously clicked answer gets stored, which should not happen,instead null should get stored.How can this be rectified,pleaze help
The better approach will be to use database at back end and keep record of the test (whether user has submitted the answer or not). Then if user refreshes the same page u can check in the database has he replied previously or not.
The second approach is to use session variables.
As soon as user submits the questions u can set the value of variable as a flag, true. Then if he refreshes the page then check the value again and thus put null values, if flag is set (true).