wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question on transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Question on transaction" Watch "Question on transaction" New topic
Author

Question on transaction

Maan Suraj
Ranch Hand

Joined: Dec 20, 2007
Posts: 299
I was asked a question in the interview..the question was like say 2 Users(say user A and user B) access a JSP page.This JSP page will display "count" and say currently the "count" value is 10.So both Users see "count" value as 10.Now this JSP has a "submit" button,and when the user clicks on that submit button,then their count should be increased by 1.Now the User A clicks on submit button,and the count increases by 1,so the count value becomes "11".But User B still sees 10,and now say User B hits submit button as well.Now instead of count increasing to "12",we should display an error message to the User B saying someone has already updated the "count" variable. How can this be achieved...

I thought either through timestamp or may be transaction..Anyone please share their views...


Man Suraj
Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"
 
 
subject: Question on transaction
 
Similar Threads
Check for File Exists using Javascript
How to make a JSP/HTML page to stay on itself when user clicks on back button on the browser?
Jsp-page populated after succesful insert
not able to send data
read access locks