• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

pagination in jsp

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
i am new in jsp. I want to give paginaiton using jsp in my application. I am able to show the records in browser. I want to display 5 records per page. I want to display them in google style like:
<<1 2 3 >>next

I am attatching my code herewith:

<%@ page import="java.sql.*" %>
<% String driverClass="com.mysql.jdbc.Driver";
String url="jdbc:mysql://localhost:3306/Test";
String userName="root";
String password="";
String user="";
String pword="";
Class.forName(driverClass);
Connection con=DriverManager.getConnection(url,userName,password);
out.println("Connection is established");
//String query="select * from userDetails ";
int count = 5;
String query="select * from userdetails limit "+count+" ";
Statement stm=con.createStatement();
ResultSet rs=stm.executeQuery(query);
out.println("Resultset created");%>


<table border=1 align=center width="100%">
<tr><th>username</th><th>password</th></tr>
<%
while(rs.next()){

user=rs.getString(1);
pword=rs.getString(2);
%>
<tr><td><%=user%></td><td><%=pword%></td></tr><%}%>
</table>


I am also giving my table structure:
tablename is 'userdetails'
fields are 'username, password, address'

It's very urgent for me.I will be very thankful for this help

Thanks in advance
Ajay Madhav
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ajay madhav:

It's very urgent for me.



Please also see: EaseUp
reply
    Bookmark Topic Watch Topic
  • New Topic