• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Refresh jstl table with javascript

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic