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.
我正在开发一个struts应用程序,在jsp页面上,有两个控件:1。Dropdown 2. Table第一次加载页面时,使用struts库中的“logic:iterate”标签在页面上显示Table。现在,我要求当用户更改下拉列值时,应根据值过滤相应的表行。我正在通过对服务器的Ajax调用来实现这一点,并且我在列表中获得了过滤结果。但我不确定如何更新表格。有没有办法通过Ajax我可以刷新表,以便再次调用逻辑:iterate?否则,我必须显示一个包含新结果集的新表,并以某种方式添加一种机制来隐藏旧逻辑:iterate table。
Thanks for the help!
谢谢您的帮助!
1 个解决方案
#1
0
Support you got a table with id = "listTable" to refresh the table with ajax, do this
支持你有一个id =“listTable”的表来用ajax刷新表,执行此操作
document.getElementById("listTable").innerHTML=xmlHttp.responseText;
where it will feed the return from the server into the table.
它将从服务器返回到表中。
#1
0
Support you got a table with id = "listTable" to refresh the table with ajax, do this
支持你有一个id =“listTable”的表来用ajax刷新表,执行此操作
document.getElementById("listTable").innerHTML=xmlHttp.responseText;
where it will feed the return from the server into the table.
它将从服务器返回到表中。