I am going to explain what I want to do with an example.

Let's say that I have a table with the following columns: TYPE,NAME,LASTNAME,ADDRESS and also I have another table with: TYPE,COUNTRY,CAPITAL,POPULATION

I joined both tables, so the field (column) that let me distinguish between my two tables is TYPE (PERSONNEL & WORLD COUNTRIES)

I have created a Search Page, where users can select the table where they want look information. If they select PERSONNEL I only have to display the columns related with this table: NAME, LASTNAME, and if they select WORLD COUNTRIES, the results must display the columns COUNTRY,CAPITAL,POPULATION.

The table is in a database, I already did the query but I do not want to display all the columns that the table has. The columns that I should display in the result page are depending on users’ selection.

How can I do that with JSP?