Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Updating a table in HTML using JSP.  RSS feed

 
Vasiq Molvizadah
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on a project in HTML and in one of the JSP page it retrieves a table data from the database but i'm really confused in "How will i change the table data in JSP if an event occurs"...
 
Deepakkumar Devarajan
Ranch Hand
Posts: 54
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You question is not clear , please tell us the actual scenario... Do you wanna change the data of the table or you wanna refresh table data in jsp?
 
Vasiq Molvizadah
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've a webpage which retrieves the "Book Lists" from the database and it puts the data in the table. But when i click on the next button/next page, how the Table Data should change.

Look at the code below.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You either need to refresh the entire page with the new data, or use Ajax to replace only the table in the page.

In either case, putting Java code into a JSP, especially database access code, is a really poor practice. You should refactor your JSP to modern standards.
 
Deepakkumar Devarajan
Ranch Hand
Posts: 54
Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Refresh you webpage every five seconds using javascript. The below code will refersh the page every 10 seconds.



You should have done the DB connection part in DAO, Before loading this JSP page, go to servlet Create and instance forl DAO class and perform all necessary operations (retain all values in bean)and forward your response to JSP. This will be good practice for a beginner, then slowly move to advanced frameworks
 
Juan Ricardo Herrera
Greenhorn
Posts: 2
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


WHEN THIS PAGE IS REFRESH, THE TABLE DOESN'T UPDATE, THE BROWSER SHOW THE SAME CONTENT ALWAYS, I DON'T KNOW, HOW TO REPAINT THIS PAGE WHEN THE DATABASE INFORMATION CHANGE

THANKS!!!

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!