• Post Reply Bookmark Topic Watch Topic
  • New Topic

Update DB values within jsp  RSS feed

 
Partheban Udayakumar
Ranch Hand
Posts: 499
AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I am trying out jsp and servlets now for the first time. I have to insert two data, car code and car name into a mysql table. I got those details using jsp but if I use form, it redirects to another page for insertion. I want the data to be inserted and still remain in same jsp page. I am thinking of using onClick from javascript but as I googled this many places have said it is a bad idea to use jsp inside javascript. If so how can we insert data to mysql table without redirecting to another page?
 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can make an ajax call to back end while staying on same jsp page.When making call pass values to servlet.
That will do the database updation thing and you can stay at same JSP page.

Search for ajax example with database , you will be able to get implementation example..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!