tags:

views:

313

answers:

2

Hello Experts,

I am working on a struts application and on a jsp page, there are two controls: 1. Dropdown 2. Table When first time page loads, Table is displayed on the page using "logic:iterate" tag from struts library. Now, I have a requirement that when user changes the dropdown value, corresponding table rows should be filtered based on the value. I am implementing this with the Ajax call to the server and I am getting the filtered results in the list. But I am not sure how I will refresh the table. Is there a way that through Ajax I can refresh the table so that logic:iterate will again be called? Otherwise, I have to display a new table with new set of results and somehow add a mechanism to hide the old logic:iterate table.

Thanks for the help!

A: 

Support you got a table with id = "listTable" to refresh the table with ajax, do this

document.getElementById("listTable").innerHTML=xmlHttp.responseText; 

where it will feed the return from the server into the table.

Zteeth
A: 

But my Ajax response is not html, so i can't simply replace the innerhtml. I am getting an arraylist as an response. Here is how, table was created initially



Here first time when page loads, in the Action class, I set the list "libraryUpdateList" in the request.setAttribute and struts then display all the records accordingly. Now, when I am calling ajax on dropdown value change, I am getting a new filter list "libraryUpdateList" in my Ajaxaction class, but I don't know how I will display the table with this new list. Hope this clarifies my question

Yatish