• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

page refresh using ajax

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What will trigger the refresh of the table? You don't say.

Do you just want it updated at regular intervals?
 
Angel Ax
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you provide some sample code how to do it
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope. You write the code and we help you with it.
reply
    Bookmark Topic Watch Topic
  • New Topic