I have a Form with 30 input fields. The form is intitally populated with Data from a Database and user can update one field or 30.. When the update occurs I have to write one record for every field that the user changed ( Nice DB design , I had no part in it ) Is there a easy way to determine which field was updated ? Or do I have to compare each field in my Servlet to figure this out. ( I use to code in CICS (mainframe) and when we needed to determine if a field changed we would check an attribute flag thats why I asked this question)
That is a problematic approach as it wil false positive fields that are set back to their original value. If that's not an issue it is one way to approach it but I generally would rather explicitly deal with this on the server rather than implicitly on the client.
If I recall right, the CICS environment would have had the same possibility of false-positives. However I agree that the straight-forward method of comparing the data sent to the browser with the data coming back from the browser is a good way to go.
The problem lies in not to check if each entry has been changed, but rather, in adding a record for each changed record. If the comparison is not done properly, you might end up in adding records for attribute whose values haven't changed(which is a major back end bug).
And as explained by the marshal..this is the first thing that comes to mind.
I would suggest you to go with the tried and tested traditional way.
Everything's tough until you try your best