Connecting Tech Pros Worldwide Help | Site Map

How to refresh HTML page from MySQL

  #1  
Old August 28th, 2008, 01:18 PM
Newbie
 
Join Date: Aug 2008
Posts: 1
In a WebApplication (Java - NetBeans) in a JSP page I need to refresh a synoptic design (the state of elements) or the records in a table by reading new data from MySQL (apply a java method).
How can I applay this methods every second? I have a javascript methods hwo is running every second.
I can send you the code in the .jsp file.

Thank you very much!
  #2  
Old August 29th, 2008, 06:05 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,521
Provided Answers: 12

re: How to refresh HTML page from MySQL


If you want server-side to run after the page has loaded, use Ajax. Every second might be too soon, so you may need to abort the current request or increase it to ten seconds. For the timing, use setInterval.
  #3  
Old September 2nd, 2008, 05:34 PM
Expert
 
Join Date: Nov 2006
Posts: 392

re: How to refresh HTML page from MySQL


acoder is correct you would want to use Ajax to do what you describe.

JavaScript and Java(JSP) are completely different technologies and do very different things in different environments. JavaScript runs on the client side in side the browser. It can not directly call Java/JSP methods since they run on the server. You can use JavaScript to call the JSP or servlet to get a new page, or use AJAX to call the server to get data that you can then use to populate the table.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting from mysql gubbachchi answers 12 August 10th, 2008 02:31 AM
ajax beginner: refresh button call doesn't change data malcster2 answers 2 July 11th, 2008 10:32 AM
refresh on submit kindermaxiz@yahoo.com answers 7 July 17th, 2005 09:51 AM
Page Has Expired Message in between the php Page When I click Back in Explorer Menu John answers 4 July 17th, 2005 05:56 AM