how to print headings horizontally in jsp

Ads
 

how to print headings horizontally in jsp

In one of my jsp i have used for loop. in every iteration it will fetch value from db and print it on heading section, it prints vertically but my requirement is to print it horizontally, can anyone suggest any idea. please see the code which i have used below :

<% for(int Count = 0; Count < numberOfcase; Count++){
            String Name = (String)List.get(Count);%>         
             <dd/>
         <table border = "1">
          <tr style = "background-color:Navy;color:White;">
            <th></th>
            <th><%= Name %></th>
            <th></th>
          </tr>
          <tr>
            <th>Time</th>   
            <th>Successful</th>
            <th>Unsuccessful</th>
          </tr>       
              <%
              try{
                 rs = stmt.executeQuery(queries[Count]);
                 while (rs.next()) {
                    startDate = rs.getString(1);
                    endDate = rs.getString(2);
                    ID = rs.getString(3);
                    successCount = rs.getString(4);
                    failureCount = rs.getString(5);             
                    //out.println(startDate+" "+endDate+" "+ID+" "+successCount+" "+failureCount); %><br/>          
                    <tr>            
                        <th><%= endDate %></th>
                        <th><%= successCount %></th>
                        <th><%= failureCount %></th>
                    </tr>
                <% }
                }catch(Exception e){

Thanks in advance

View Answers

April 4, 2012 at 12:56 PM

<%@ page import="java.sql.*"%>
<html>
<body>

<form method="POST">
        <%
        int l=0;
        int rowcu=0;
        int totalRecords=0;
        ResultSetMetaData rsmt=null;
        ResultSet rs=null;
        String query="select * from person";
        try{
            Class.forName("com.mysql.jdbc.Driver");
           Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
            Statement st1=conn.createStatement();
            Statement st2=conn.createStatement();
            Statement st3=conn.createStatement();
            ResultSet rs1=st1.executeQuery(query);
            ResultSet rs2=st3.executeQuery(query);
            int x=0;
            while(rs2.next()){
            x++;
            }
            rs1.next();
            rsmt=rs1.getMetaData();
            l=rsmt.getColumnCount();
            rs=st2.executeQuery(query);
        %>
        <table border="1" >
        <tr>
            <%for(int v=1;v<=l;v++){
                String cnames=rsmt.getColumnName(v);
            %>
          <td ><%=cnames.toUpperCase()%></td>
          <%
                }
          %>
          </tr>
          <%
          while(rs.next()){
          %>
          <tr>
          <%
          for(int vc=1;vc<=l;vc++){
          %>
          <td><%=rs.getString(vc)%></td><%
          }
            }%>
          </tr>

  </table>
  <%
      }
        catch(Exception e1){
        }
  %>

</body>

</html>

For more information, visit the following link:

Visit Here

Ads









Related Tutorials/Questions & Answers:
how to print headings horizontally in jsp
how to print headings horizontally in jsp  In one of my jsp i have used for loop. in every iteration it will fetch value from db and print it on heading section, it prints vertically but my requirement is to print it horizontally
How to display a record containing 30 fields in jsp without scrolling the page horizontally?
How to display a record containing 30 fields in jsp without scrolling the page horizontally?  I want to display records containing 30 fields in a table row.Is it possible in jsp without scrolling the page horizontally
Advertisements
How to make a horizontally Scrollable grid in jsp using div, table, css, javascript?
How to make a horizontally Scrollable grid in jsp using div, table, css, javascript?  In a jsp page InsertUpdate.jsp (say) there is a button Insert... distorted to accommodate 30 fields.How can I make it Horizontally scrollable
How to print a webpage without url and date in jsp ?
How to print a webpage without url and date in jsp ?  How to print a webpage without url and date in jsp
how to print the server time
how to print the server time  how to print the server time in jsp and update time in fix interval
how to print data(From databse Oracle10g) in preformatted A4 and A3 paper using jsp
how to print data(From databse Oracle10g) in preformatted A4 and A3 paper using jsp  how to print data(From databse Oracle10g) in preformatted A4 and A3 paper using jsp. I am inserting analysis report into a database using
How to print this Format exactly?
How to print this Format exactly?   * * * & reverse
How to print this in java?
How to print pattern in Java?  How to print a particular pattern in Java...;  How to print this in java
how to print the server time
how to print the server time  i want to print database time in clintside and update time in every secound without creating connection to database for each time. how can i do
how to print String as pattern ?
how to print String as pattern ?  i have a one String name ="rajesh" i want to print pattern like r * ra ** raj raje rajes rajesh please help me
How to print UIButton id
How to print UIButton id  How to get the id of the button in the IOS application? Thanks   Hi, You can use the following code: - (IBAction)btnClicked:(id)sender { UIButton *button = (UIButton *)sender; int
how to print the following pattern
how to print the following pattern  Hello hEllo heLlo helLo hellO pls reply soon its an emergency   class StringPattern { public static void main(String[] args) { String st="hello
how to print pdf format
how to print pdf format  Hi every body iam doing school project iam using backend as oracle front end java .how to print student marks list /attendence in pdf format. please help me. thanks in advance.   Here
how to print JInternal frame component ?
how to print JInternal frame component ?  hello sir, i devalop a swing application .but problem is that how display report & print it. some data prefech from database & keep to jtable but how it is print with table
how to print spark dataframe data
how to print spark dataframe data  Hi, I have a dataframe in spark and i want to print all the data on console. How it can be done. how to print... is in "data" variable and you want to print it. Its simple and one line function to print
how to print spark dataframe data
how to print spark dataframe data  Hi, I have a dataframe in spark and i want to print all the data on console. How it can be done. how to print... is in "data" variable and you want to print it. Its simple and one line function to print
How to display date in JSP?
How to display date in JSP?  How to create a simple JSP program which...; Then use the following code to print the current date: <%= new java.util.Date() %> Check complete tutorial at How to Create JSP Page? Thanks
How to print like printf in python
How to print like printf in python  Hi, I am from C background and there used to be printf function. Jow to print like printf in python? The printf function is C/C++ is very useful. So, looking for some line printf in Python
How can print integer in method
How can print integer in method   a method call process public process(int jobid,int remain){ } how to print int jobid ,int remain in for loop jobid in proc[0],remain in proc[1],both show in text file how to print proc[0
How to design a foot print on the sand, print on the sand, print
How to design a foot print on the sand       You might have seen foot prints on the sand field. Do you think, it can be design in the photoshop, yes I have done here. I have used
How to Print a Stack Trace Message
How to Print a Stack Trace Message  Debugging of Java program requires... times you have to print the detailed error message on the console... will print the detailed message on the console. You can use
How to print current time in r?
How to print current time in r?  Hi, I am learning and want to print current date and time on console. How to print current time in R Programming? Thanks   Hi, You should use Sys.time() for getting current date
How to print the following pattern in java?
How to print the following pattern in java?  How to print the following pattern in java? he he is he is going he is going in   import java.io.*; class StringPattern { public static void main(String[] args
How to call servlet in JSP?
How to call servlet in JSP?  How to call servlet in JSP
how to make exampage in jsp ?
how to make exampage in jsp ?  how to make a online exam page in jsp and servelet
How to display date in JSP?
How to display date in JSP?  How to create a simple JSP program which displays date on the page? Thanks
how to print of hours and minutes of 8725 seconds
how to print of hours and minutes of 8725 seconds  how to print of hours and minutes of 8725 seconds
how to print all colors using awt
how to print all colors using awt  how to print all colors using awt
How to pretty print XML from Java?
How to pretty print XML from Java?  How to pretty print XML from Java
How to connect to MySQL in JSP?
How to connect to MySQL in JSP?  How to connect to MySQL in JSP..., You can use the Java JDBC code to connect to MySQL database in JSP page. Check the tutorial: Connect JSP with mysql Thanks
How to call print dialog box through JMenuItem?
How to call print dialog box through JMenuItem?  What is the way to call the print dialog box through JMenuItem to print the current page like we can do in javascript by calling window.print() function

Ads