• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

editing values in the jsp and updating the table

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic