Search code examples
mysqljspsynchronizationdata-synchronizationsimultaneous-calls

How to synchronize flow of action in java web application using struts?


I am developing a web application in JSP with back-end MySQL.

I need my application to be used by more than one users simultaneously for transactions.

There i am facing the following problems.

  • In the application, there are time slots available to make appointments.
  • When multiple users are making appointments on the same slot simultaneously, system shows message like appointments has been made. In the back end , both datas are saved with different id ( for the same slot).
  • But in the front end- it shows only one user data.

How can make synchronization in the function.

Please help me to solve the problem


Solution

  • I think, currently how you codes your logic like, once the instruction to book the slot from the user , just save it.

    Try like this, after when you got the instruction to book a slot, in java page( in saving logic ) first check to make sure no one else has made it. If no such result found book it, else show message that its already booked.