This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JSP and the fly likes pagination in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "pagination in jsp" Watch "pagination in jsp" New topic

pagination in jsp

ajay madhav

Joined: May 12, 2008
Posts: 1
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="";
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%">


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
Ben Souther

Joined: Dec 11, 2004
Posts: 13410


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Originally posted by ajay madhav:

It's very urgent for me.

Please also see: EaseUp
I agree. Here's the link:
subject: pagination in jsp
It's not a secret anymore!