Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7429725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:01:04+00:00 2026-05-29T09:01:04+00:00

I have created a Database Application using Netbeans, GlassFish and JavaDB. Now my controller

  • 0

I have created a Database Application using Netbeans, GlassFish and JavaDB. Now my controller Servlet code executes some dynamic SQL queries and get back a Result Set (or I can ahange toString). Now, how can I show the returned Result Set in a tabular format ( I have no idea about structure of result set). Can anybody help me about this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:01:05+00:00Added an answer on May 29, 2026 at 9:01 am

    You can use Map<String, Object> to represent a “dynamic” row, which is iterable in <c:forEach>. You can use ResultSetMetaData to collect information about the columns such as the column count and the column labels.

    So, this mapping should do:

    List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>();
    ResultSetMetaData metaData = resultSet.getMetaData();
    int columnCount = metaData.getColumnCount();
    
    while (resultSet.next()) {
        Map<String, Object> columns = new LinkedHashMap<String, Object>();
    
        for (int i = 1; i <= columnCount; i++) {
            columns.put(metaData.getColumnLabel(i), resultSet.getObject(i));
        }
    
        rows.add(columns);
    }
    

    You can display it in JSP as follows:

    <table>
      <thead>
        <tr>
          <c:forEach items="${rows[0]}" var="column">
            <td><c:out value="${column.key}" /></td>
          </c:forEach>
        </tr>
      </thead>
      <tbody>
        <c:forEach items="${rows}" var="columns">
          <tr>
            <c:forEach items="${columns}" var="column">
              <td><c:out value="${column.value}" /></td>
            </c:forEach>
          </tr>
        </c:forEach>
      </tbody>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using c# .net windows form application. I have created a database which has
I have created a database for my application. Now I want to make sure
I have created a database, linked it with DomainService's within my Silverlight Application. Now
I am creating a database application using the SQLite3 library. I have created a
Hey, sorry for my bad english... Using EF4 code-only, I have created some POCO
Im using c# .net windows application form. I have created many databases with many
Im using c# .net windows form application. I have many databases created using sql
I have created a MySQL database using MySQL Workbench. It has about 20 tables.
I have a database that I have created using SQL Server Developer 2008. I
I have created an desktop application in Netbeans 7.0 and i have the files,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.