• Post Reply Bookmark Topic Watch Topic
  • New Topic

Refresh jstl table with javascript  RSS feed

 
ardur amrahs
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a table generated about a list of people using JSTL for each:


The code is functioning fine, however I need to be able to refresh this table using javascript. Using ajax, i am able to changed the "People" list. However, I don't know how i can tell the JSTL code to reload the People list and regenerate the table. I am faily new to this, so much help would be appreciated.
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ardur,

I don't know how i can tell the JSTL code to reload the People list and regenerate the table


You can notdo this in JSTL because you want to modify table at client side. Only you can do this by using javascript.
You can get new table data by calling serverside by AJAX, then that will return you a string which contains all data in table while constructing that string on server side you need to add data by some separators so you can parse that string in javascript at client side and populated data in table.

For this you should add id for each td in table and get that td in javascript by document.getElementById("Id").innerText = "dataGetFromAJAX".
you need to writ lot of javascript to accomplish this task.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shailesh Narkhede wrote:then that will return you a string which contains all data in table while constructing that string on server side you need to add data by some separators so you can parse that string in javascript at client side and populated data in table.


Why do it the hard way? Parsing and formatting on the client is a poor use of the available tools and resources.

Have the Ajax call return the fully formatted table and just stick it in the DOM, replacing the original table.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!