aspose file tools*
The moose likes JSP and the fly likes showing values in table on basis of column header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "showing values in table on basis of column header " Watch "showing values in table on basis of column header " New topic
Author

showing values in table on basis of column header

Tanu Gulati
Ranch Hand

Joined: Oct 06, 2008
Posts: 113

hi,

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.

Is it possible to do in jsp ?

thanks,


thanks
Tanu Gulati
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1


Not clear what you are trying to achieve now.

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?

Cheers,
Raj.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
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)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: showing values in table on basis of column header
 
Similar Threads
Java JSP Design Issue
call a method in portlet action class from javascript function
Retrieving ArrayList from Display Table after sorting
Help on defining CSS
Retrieving ArrayList from Display Table after sorting