In my Web Application, i have a data table(Displayed from DB using PreparedStatement). Each row have an edit button. A form is situated below the table. If i click edit button, the data from the row will be filled into the form. So, that i can edit and save it.
Or, i can enter new data in the form and a add new row. The issue is the “Save” button. Update & Insert needs different queries.
SO, i want to call two different methods.
Any idea regarding this issue.
Addtional informations:
The web page was built using HTML & Java Script. Java used in back end to connect DB and get Data.
Thanks.
You could add, in an hiddden field, the id of the edited element. If no id is provided, it’s a new object, and if an id is provided, it’s an edit operation. Obviously, to prevent spying you should replace real id by hashed ones.