st=con.createStatement(); System.out.println("Before Select"); rst=st.executeQuery("select count(*) from tablename"); System.out.println("After select"); while(rst.next()) { a=rst.getInt(1);//THIS IS TOTAL NO OF ROWS IN UR TABLE }
no_of_pages=a/20;//WHERE 20 IS THE TOTAL NO OF ROWS U NEEDED IN A PAGE st.close(); rst.close(); %> <center> <table border="1" width="358"> <tbody> <tr> <td width="100">vend_id.</td> <td width="124">vend_name</td> <td width="127">vend_address</td> <td width="127">vend_panno</td> <td width="127">vend_phone</td> <td width="127">vend_creditday</td> <td width="127">vend_tinno</td> </tr> <% try {
</tbody> <%for(int p=0;p<=no_of_pages;p++) { %> <a href="Servlet1?pageno=<%= i%>"><%= i%></a >// THIS IS TO SHOW like 1 2 3 4 5 6 etc AND A LINK TO SERVLET Servlet.java
write the servlet code and jdbc connection, read values from table....
now in while loop.... assign each values to corresponding arrays..... use command as follows... PrintWriter pw=res.getPrintWriter(); pw.println("<head></head><body><table><tr>"the column tags according to their name"</tr>);
now a for loop from int k=0 to 20(20 rows will be displayed)... pw.println("<tr><td>array value(k) for each column</td></tr>");
August 22, 2008 at 12:43 PM
U have to make many changes......... i just drawn a layout for the problem........ Thanks and Regards Prashu prashobvee@gmail.com
August 22, 2008 at 1:02 PM
hai frnd..... make a small change in the jsp .... at the href tag.....i used "i" instead of "p"....please make the correction