This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

editing values in the jsp and updating the table

Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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,
Posts: 25220
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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.
It's feeding time! Give me the food you were going to give to this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!