Ah, I have set up something similar.
The system generates web reports. The end user (it's a logged in system) can specify "column preferences" such as which of the available columns for a report are to be included, the column order, initial sort, and even formatting options on a per-column basis. And since the report results can run into tens of throusands of rows, they can also specify a "page size" and extensive report filters.
Each user's "column preferences" are stored in the DB. On the report pages there is a "report" tag that identifies the report to be generated. The tag handles generating the HTML table for the report results, as well as relevant controls for filtering and paging. This is all generated using the dataset returned from the report query, as well as from the column prefs which are read from the DB and stored in
Java objects that model the preference values.
So, the tag structure on the page is incredibly simple. Something along the lines of (simplified to show only relevant details):
As the tag code has access to the pageContext and hence the session, it can obtain the column prefs from the user info stored in the session for the logged-in user.
The id attribute specifies which report is to being generated. The formName attribute gives the HTML name of the form in which this report is enclosed. This form is submitted by code generated from the tag whenever a column header is clicked (for sorting), paging is requested, or a filter is changed.
The relevant part of all this is that the "column preferences" aren't specified on-page in any tags like you were attempting to do. The prefs are stored on a per-user basis in the DB and modeled using Java objects that the "report" tag uses to generate its output.