I am creating a web application using a mvc jsp/servlet architecture. I am having a problem deciding how to maintain transaction state across multiple pages. Eg I have say three
jsp pages which will each save information to separate database tables which comprise a single transaction. The problem arises when the user decides to hit the back button and goes back to the first page, at this point in the transaction three records have already been posted to the database (not comitted as I have set autoCommit to false). Now if the user decides to make changes to the first page and hit the submit button I would essentially like to rollback all transactions to that first page and start over again.
if the user decides to hit the back button to the second page(coming from the third page) I would like to rollback to that point only.
I hope you see the general trend. Of course the rollback would only occur when the submit button is pressed on the page you backed up to.
I have seen solutions by setting tokens in the request and session objects, but this only allows you to perform the transaction only once.
Now I was thinking that when processing each page I could set a savepoint and manipulate the rollback scenarios as described above theoretically( haven't tried it as yet)
Questions
1)is this feasible?
2)I think savepoints are only available from jdk1.4 and up how would I implement under jdk1.3
3)What is the best practice to follow in such scenarios?
Any links, all advice would be highly appreciated.
Gary