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 8796945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:44:26+00:00 2026-06-13T23:44:26+00:00

I have the below code in my jsp. Here in the output the rows

  • 0

I have the below code in my jsp. Here in the output the rows are shown as columns and columns are shown as rows.

enter image description here

<%@page import="com.sun.crypto.provider.RSACipher"%>  
<%@include file="DBCon.jsp" %>  
<body><form action="Export1.jsp" method="post">  
<table border="1px"><TR>  
<%  
    ps=con.prepareStatement("Select * from Scope2");  
    rs=ps.executeQuery();  
    ResultSetMetaData rsmd=rs.getMetaData();  
    int NumOfCol=rsmd.getColumnCount();  
for(int i=1;i<=NumOfCol;i++)  
{%></tr>  

<%  
try  
               {  
    ps=con.prepareStatement("Select * from Scope2");  
    rs=ps.executeQuery();  
       while(rs.next()){  

           %>  
                  <td><%=rs.getString(i)%></td>  
           <%  
       }  

}  
catch(Exception e)  
               {  
    out.println(e);  
}}%>  
   </table><table><tr>  
    <input type="Submit" value="Export"></tr></table></form></body> 

and the output is as in Screen 1 but i want the output to be as in screen 2. please help me .

Thanks.

  • 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-06-13T23:44:27+00:00Added an answer on June 13, 2026 at 11:44 pm

    You have messed with the row formatting and the loops. Here is the updated code –

    <body><form action="Export1.jsp" method="post">  
    <table border="1px">  
    <%  
        ps=con.prepareStatement("Select * from Scope2");  
        rs=ps.executeQuery();  
        ResultSetMetaData rsmd=rs.getMetaData();  
        int NumOfCol=rsmd.getColumnCount();  
    
    while(rs.next())  
    {%>
    <TR>
    <%  
    try  
         {  
           for(int i=1;i<=NumOfCol;i++){  
    
               %>  
                      <td><%=rs.getString(i)%></td>  
               <%  
           }  
    
    }  
    catch(Exception e)  
    {  
        out.println(e);  
    }
    %></TR><%}%>  
    
    </table><table><tr>  
    <input type="Submit" value="Export"></tr></table></form></body>
    

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below piece of code in one my JSP <%@ page language=java import
In my .jsp file I have the code below. How can I compare the
I have below code.The logic here is if HostList conatains any blanck entry it
I have this secMarket.xml in my struts2 project, the code is below here: <struts>
I have a very simple issue. Below is my JSP code , where I
To summarize the answer shown here Code assist in (jsp /jstl) view for Spring
I have below code in jsp myDisplayImage.jsp <!DOCTYPE html> <html> <head> <meta http-equiv=Content-Type content=text/html;
I have below code in my legacy project in jsp: <tr> <th colspan="2">Customer</th> <td
I have below code: <a href=# id=@item.Id name=vote ><img src=/Content/images/021.png style=float:left alt= /></a> which
I have below code: class Program { static void Main(string[] args) { Task[] tasks

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.