Good afternoon people! When I click the Change button, I check to see if the data in the database remains the same. How do I return a confirmation window if the results are not the same?
Example: I select the material I want to change, fill in the inputs, but before clicking Change, I leave the table for some reason, and another user on another computer changes this same material. When I go back and click Change, does the data check, how do I show a message stating that the data has changed and asking if I still want to change it?
Henry Wong wrote:
Generally, information (including messages) are conveyed from a servlet to a JSP by adding the data to scoped variables (aka "attributes") and forwarding to the JSP. But whether that's the appropriate course of action in this case is not yet clear.
The server side does not really change much.
It needs to detect the database concurrency issue, and inform the JSP appropriately.
I presume you have handled that side of things.
Well there are two basic options on the client side:
Option #1: Click button - send HTTP Post request via submitting a form.
- sends request, replaces current page with response. You would need to repopulate the page as it was when submitted, and add an "error" note to the page.
Using AJAX and making "single page applications" is the current trend as I understand it.