This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes page refresh using ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "page refresh using ajax" Watch "page refresh using ajax" New topic
Author

page refresh using ajax

Angel Ax
Greenhorn

Joined: Jun 03, 2010
Posts: 5
hi

I am facing a problem refreshing a page ....need to use ajax
my Login page calls a servlet (LoginServlet) which has the Business logic and fetches data from the db and fwd its to a jsp page ....I am using display tag library to display data ... this table needs to be refreshed after a timegap using ajax also note that there is no event that can be used like a button or something ..

I can do it using response.setheader but that flickers the page .....


Kindly help with some ajax solutions...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60047
    
  65

What will trigger the refresh of the table? You don't say.

Do you just want it updated at regular intervals?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Angel Ax
Greenhorn

Joined: Jun 03, 2010
Posts: 5
Yes it should get updated without a trigger as my jsp page has only a table and no button or textboxes

Also note that the data is passed in a hashtable from the servlet to the jsp where it get displayed
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60047
    
  65

You can use window.setInterval() to cause a timer to go off at regular intervals.

By the way, I strongly suggest adopting jQuery to do your Ajax. There are too may pitfalls to doing Ajax "by hand", and jQuery will allow you to retrive the new table from server and insert it into the DOM with one JavaScript statement.
Angel Ax
Greenhorn

Joined: Jun 03, 2010
Posts: 5
can you provide some sample code how to do it
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60047
    
  65

Nope. You write the code and we help you with it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: page refresh using ajax
 
Similar Threads
servlet-jdbc
page refresh using ajax
Export to xls file - Download file using AJAX
Ajax Size Limit
Retrieving a Java Object from AJAX Respnse