I have a technical problem related to java html and jsp where I have to show a table. Table is such that it has headers on top of table and when page loads I should load the data in table depending on corresponding column header.
To be more specific- I would like to call a function on every "square-box" of column/rows and call a function with column header name as parameter in java which returns me the data and I need to show it in table.
The data to be displayed is probably generated dynamically and in that case you could take care of that in server side Java code. Now why would you want to have a separate Server call (I assume) each time a table column is rendered?
I feel you should have the logic for generation of the table headers/rows/columns in your server side code and JSP should be used for dynamic display purposes.
Could you please elaborate your requirement a little?
I'm guessing the data structure you are wanting is List<Map<String, Object>>
ie a List of Maps, each entry in the list representing one 'row' of the table, and the map being the values to display.
The key to the map being the 'column heading', and the value, the value to display in that column.
Its a fairly standard pattern for writing a 'generic' table that can display whatever you configure it to.
Personally I prefer defining the columns rather than having them be dynamic, and using a java bean with attributes rather than entries in a map, but it does work.
It goes something like this (untested)
subject: showing values in table on basis of column header