how to create a table in the jsp dynamically without knowing the number of columns using struts
Thilak Raj Shanmugham
posted 3 years ago
Hi, am a bit newbie to struts but i could use some help in this....
In my screen the user will have only the table name to select. So the system has to get the table data from the db using the table name and show it on the front end screen.
The challenge am facing is i dont know how many columns that table has so i cant have the Action Form with the setters and getters. So far i have managed to get the column names in a separate list using resultsetmetadata and data in the separate list in the Action class.
My ultimate question is .. how to create a table in the jsp dynamically without knowing the number of columns and display the rows without setters and getters using struts.
I think what you are asking for is Indexed Properties. Each field's name is an index into a collection. The getters and setters in the action take a collection as an argument. If you search this forum or the web, you'll find plenty of examples.