This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
But in JSTL how would I access the various rows without knowing what the column names are. Like I said it's hard to add exact column names in a javabean. There are thousands of them in various databases.
Some of the dbs and tables change every month, week, and so on. It would be a waste to set up setColumnOne and getColumnOne in a javabean if that column is deleted next week or if they add another column next month. It happens often. New materials, new tools, new equipment, new usages.
It's much easier reading how many columns there are for a table, setting the column names on the fly, then retrieving the results.
I'm not sure how to do this just using JSTL.
Maybe I'm storing my results wrong or maybe I'm storing my bean wrong. I'm really not sure how to move on at this point, except of course not using JSTL at all.
Firstly. resultset and JSP should never be used in the same sentence! It's considered really bad practice to send something as db specific to the UI, not to mention the fact that you are holding the connection open during that time.
Conventionally, a JavaBean is created for each row. But, if as you posted, that's a non-starter, I'd consider a Map for each row. You can query the result set metadata for the names of the columns and included a list of those in conjunction with the map so you'll know what the key/property names will be.