*
The moose likes JDBC and the fly likes editing values in the jsp and updating the table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "editing values in the jsp and updating the table" Watch "editing values in the jsp and updating the table" New topic
Author

editing values in the jsp and updating the table

Komal Amaresh
Ranch Hand

Joined: Oct 06, 2008
Posts: 67
Hi,

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.

Please help me.
Thanks in advance,
regards,
Komal
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: editing values in the jsp and updating the table
 
Similar Threads
Error in action class
Unable to create many-to-one mapping
Setting checkbox from database.
Help. Problem inserting Clob into Oracle 9i
Update in For loop.