• Post Reply Bookmark Topic Watch Topic
  • New Topic

Updating DB from JSP

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , I have a table displaying data from a DB on a JSP page. Users can edit various fields on the table and submit the changes. Now I am having a bit of problem with submitting the changes and updating the DB , since I want to keep the jsp for displaying purposes only , I want to send the changed data back a servlet to actually update the DB.My question is what is the best way to send the changed data back to the servlet.
I mean suppose the original row was something like this



Now what would be the best way to send this data back to the servlet. I could create a map having the original row values and the new row values and pass that map to the servlet which will check for the changes and update the DB. Is this the proper way ?? Sugestions are always welcome

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to submit a request without refreshing the whole page then Ajax is the way to do it.
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know i could use AJAX. Here i actually dont mind the entire page being redirected to a servlet so no need for AJAX. Since once the user is done making all the changes he clicks the update button and the DB gets updated. I am just a bit confused on the data structure or mechanism to use to send the changes to a servlet. Does my previous idea sound reasonable ??
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You wording confused me, I thought you didn't want to submit the page.

All submission to the servlet should be normal request parameters as name/value pairs, so I'm not sure what you are asking beyond that?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!