File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes updating a table using Ajax? 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 "updating a table using Ajax?" Watch "updating a table using Ajax?" New topic

updating a table using Ajax?

Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
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

Joined: Jan 10, 2002
Posts: 63865

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.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: updating a table using Ajax?
It's not a secret anymore!