I am working on a struts application where multiple people have the potential to touch the same files. Because of this I need to ensure that they don't overwrite each others work. My thought process is when a person clicks to edit a form keep a copy of the information as it was when the edit started. When the user tries to submit I will check to see if the data has changed before committing the change. The part that I am not 100% certain what to do is if the data has changed I am throwing a DataIssueException. When it goes to my action controller how would I go about warning the user that someone else has changed the data since they started ?
I would think you would treat this basically the same as a validation error. Save the ActionError/Message and forward the user to the same place as the input attribute.
From a processing stand point, what do you plan to do when this occurs? Show the user a message saying "I know you just spent 10 minutes updating this data but somebody else changed one of the fields so I am going to throw away all your changes and force you to restart" ;-) Is your code smart enough to know which fields changed and to merge the changes?
Joined: Aug 23, 2006
The changes being made would most likely never take more than 2 minutes, but it's still something that I have to worry about. I don't think it would make sense to merge the changes, as some fields are dependant on others. The manner in which I decided to deal with it is to allow the user to decide if they wish to continue with the changes or if they wish to stop the changes and go reload the form. Perhaps not the best option, but it is already extremely unlikely that this situation will occur.