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, 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









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 contents of a web page in jsp?
How to print contents of a web page in jsp?  I have generated a pay slip using jsp.How do I print the contents of the slip
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
Clear the print button after onclicking the print - JSP-Servlet
Clear the print button after onclicking the print  rate_print.document.writeln(" "); hai sir, this is my java script code, i ask how to clear the printbutton image when after onclicking the print button....  Hi
how to print - Java Beginners
how to print  how to print something on console without using System.out.print() method ?  Hi Friend, You can use PrintWriter to write anything on the console. import java.io.*; public class Print{ public static
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 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 on pre-printed cheque - Development process
how to print on pre-printed cheque  I want to print on pre-printed cheques using java and jsp .please provide me the source code which help me to resolve this problem
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 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 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
viewing the ms word in print layout from jsp - Java Beginners
viewing the ms word in print layout from jsp  Hi all, I am trying to export ms word from jsp in print layout format.I used the code... is to open in print layout format. If u have any code for converting into print
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
print
print  How to print JFrame All Componant?   Please visit the following link: http://www.roseindia.net/java/example/java/swing/Print.shtml
Take print out from printer at client machienusing jsp - JSP-Servlet
Take print out from printer at client machienusing jsp  Sir/Mam I want do is to take out print out of my report which will be created from the Mysql database with out displaying him/her the results or report from the printer
how to print all colors using awt
how to print all colors using awt  how to print all colors using awt
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 pretty print XML from Java?
How to pretty print XML from Java?  How to pretty print XML from Java
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
how to call the print dialog box through JMenuItem
how to call the print dialog box through JMenuItem  What is the way to call the print dialog box through JMenuItem to print the current page...could you please help me by sending code
how to print from right to left in java????
how to print from right to left in java????   can anyone pls tell how to print from right to left in java
how to print dot in python without newline
how to print dot in python without newline  Hi, I a debugging python program and I am using following code to print dots: print... to print 20 dots without new line. Is there any easy solution? how to print dot
how to print dot in python without newline
how to print dot in python without newline  Hi, I a debugging python program and I am using following code to print dots: print...? how to print dot in python without newline?ADS_TO_REPLACE_2 Can I use variable
How to print a equilateral triangle patren with numbers
How to print a equilateral triangle patren with numbers  I figure out how to use for loop to print the triangle but i couldn't get the exact values as this http://im37.gulfup.com/FzrOb.jpg could you please help me
how to print float with 2 decimals python
how to print float with 2 decimals python  Hi, I am new to Python programming and trying to print float value on console. I want to print this value with 2 decimals places. How to print float with 2 decimals python?ADS
How to Print Array in JavaScript
How to Print Array in JavaScript In this section you will learn about Array... Now, here is the example how to declare and access array. <!DOCTYPE html>... Array example</h1><p><h2>Click to print the array element</h2
Print
into the stream and, as opposed to print() method, gets you to the new line after the text
How to print differences of two text files
How to print differences of two text files  I have the code to compare 2 different text files, however How can I put the difference of 2 text files in other file or print the difrference in the console?? Thanks
how to print HTML using javascript or Jquery
how to print HTML using javascript or Jquery  is there any way to print a document(created using Html and javascript) without using window.print... used Iframe for print, but this only work in chrome, but I have required one
print - JSP-Servlet
How to print list of files in client system
How to print list of files in client system  have some list of files in server.i just want to print that files in client machine with out opening the file.i give the option for user like printall.if user click printall prints
how can i print the selected content of a frame
how can i print the selected content of a frame  hello sir, I am designing a bill calculate program. I want to print the bill in crystal form. I want to skip all the text fields shapes and all the button from the frame.. but all
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i...)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir   Have
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i...)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir   Have
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i...)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir   Have
how to fill up a form automaically from database and print it
how to fill up a form automaically from database and print it  sir,i...)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir   Have

Ads