Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

updating a table using Ajax?

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am currently planning to update a table on a jsp asynchronously using the following method
A couple of parameters are passed to a servlet as such


Now the only way i know for receiving the response asynchronously is


This means all the data which will be passed from the Servlet to the jsp asynchronously will be through the printwriter object.
I wanted to know is this the only way of passing the data from the servlet to the jsp ?? so if i wanted to write an entire table will i first have to write the table out on a string and then send it through printwriter or how ??
Is even querying a table asynchronously sensible ??
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have the servlet forward to a JSP that formats the table and returns the HTML fragment as the response. Your on-page script can then just replace the table in the DOM.

P.S. This would be a lot easier with the jQuery load() method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic