File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes refresh an HTML table using AJAX and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "refresh an HTML table using AJAX and JSP " Watch "refresh an HTML table using AJAX and JSP " New topic
Author

refresh an HTML table using AJAX and JSP

aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
hello everybody;
I hope everything is going well for everyone

I am working on a project and I am stuck since quite a long ago on how to refresh some database tables I have using Ajax.

The ideal would be to refresh them automatically every for example 30 seconds, but for now I have a submit button to trigger the update.

Thank you soo much for any help you might give me.
Best regards,
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

Explore window.setInterval()


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
Thank you very much for you fast reply.
Now I got that to be working but when I click refresh, it always moves the page to the top

how can I get rid of that ?

thank you.
regards,
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

Originally posted by aymane chetibi:
it always moves the page to the top

I do not know what you mean by this.
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
You mean the Refresh button, the browser's provide (F5 thing). As the page is not refreshed back, forward, refresh etc. might not work the way you intend them to work. I guess there are some toolkits that might help you on some counts but atleast I can't remember any.

Out of curiosity I would like to know why do you want to press the Refresh button, in case if that's what we are talking about(Browser provided refresh button).
aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
I am sooo sorry, I used the wrong word.
I do not mean to use the browser's refresh button.
I meant that when the Javascript code refreshes the part it is supposed to refresh ( <DIV> ), the page is moved back to the top and the user should scroll down again to see the modifications.

I have another question, in case I want to use a servlet to update information on my View, what is the url I am supposed to use in the Javascript code ?

I used the following code and it does not seem to work:

I hope somebody can help me through with this, I hardly can find any AJAX related code on the internet.

Thank you soo much.
Best regards;
 
wood burning stoves
 
subject: refresh an HTML table using AJAX and JSP