please ignore servlet and bean codes used in this application.my question i s ,this will disply one form and if i submit it will go for validation first then go to servlet which then store in database.so i entered the 10 records.in sql prompt it shows 10 rows created.
now my problem started ,if i came to form agin and press the F5 key(refresh) button then go to sql prompt and if we see the no of records created is 11 records.why it is happening like this .how to restrict the control doesn't goto database.
When you "refresh" a page, you send to the browser the exactly the same request you sent it last time. If it is a "save" request, then it runs the save code again.
One common approach to prevent this is that after a "save" request, you redirect to a "display" page. Then if the user refreshes that page, they only refresh the "display" request, not the save request. It makes it a bit harder for them to screw things up with reloading pages anyway.