This is in respect to the question posted under make a cell editable in jsp Now I have modified my code to be a complete server side operation.
I have three columns namelu date, occassion, and state which is a boolean displayed as a checkbox.
I have two buttons add and update. On add. a new row is displayed in the page, amd passing the values in the two fields, date and occassion, The values are inserted into database with a default state true. So the jsp displays the boxes as checked on opening the page. Initially i was only updating the state by checking and unchecking the checkbox as follows:
Now I' am facing a problem, trying to update the date as well. All this seems to be a reverse operation, but this is the requirement.
I need to update the date values if required. I have taken the date as the primary key, and I have used the following query implement it.
I had used the same the same logic as above using request.getParameterValues() to retrieve the date and the status and updating both the values. There was an sqlexception thrown. I' am unable to understand whether is is because of any mistake in my query or whether it conflicts with the rule to update primary key in the database. I had tried the unique property for the date, dropping the primary key option and using an auto increment value as the primary key. But, an sql exception was thrown saying the values as unique cannot be updated. I' am using mysql for my database. I' am unable to understand how to edit both the date and the bollean as Duplicates are not allowed in the date.
The question seems to be about problems in updating a database, not about JSP at all. It's just Java code in the question (and what is that doing in a JSP anyway?) so let's move this to the JDBC forum.
And Komal, it would be useful if you posted the error message you are getting. The actual error message, copied and pasted, that is. Vague paraphrases of error messages are less than useful.