Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 28th, 2008, 01:18 PM
Newbie
 
Join Date: Aug 2008
Posts: 1
Default How to refresh HTML page from MySQL

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!
Reply
  #2  
Old August 29th, 2008, 06:05 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,733
Default

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.
Reply
  #3  
Old September 2nd, 2008, 05:34 PM
Expert
 
Join Date: Nov 2006
Posts: 351
Default

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
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles