java jstl populate table data using ajax

前端 未结 2 1186
感动是毒
感动是毒 2021-01-21 05:15

i implemented a java ee webclient in spring framework. it reads data from a webservice and display records in a table format. on this table, im able to a delete multiple record

2条回答
  •  清歌不尽
    2021-01-21 05:41

    I would remove the page refresh and use AJAX. This is how I imagine you should approach this problem. An AJAX call is made at regular intervals (using a timer) to a servlet that queries a database for the records added since the last such query. The records returned are formatted into HTML using a JSP template and tag libs and sent in the response to the client. The AJAX receives the response and appends the HTML to the appropriate table. To stop the AJAX from making a call to the servlet you could stop the timer just before showing the popup box and restart it when the page is updated with the records deleted.

    EDIT: You could identify each table with an (id="table1") and in then you can append that HTML to the right table.

提交回复
热议问题