Solved

Help me to implement the paging concept

Posted on 2002-03-12
8
756 Views
Last Modified: 2006-11-17
Hi guys i am new to Java, plz help me. My problem is ...

   I am trying to develop JSP page with paging navigations like page 1 of 10, when the user in page 1, he should see only the first 10 records. when he on second page, he should see only the 2nd 10 record.


   Is it possible to do this? Thanks in advance. (if possible, with sample code).
0
Comment
Question by:selvamtvl
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 9

Expert Comment

by:Venci75
ID: 6856108
How do you access these records?
0
 

Author Comment

by:selvamtvl
ID: 6856125
Thanks for your initialization Venci75.

     I don't know how to access but i need help from someone like you. I am using oracle 8i as my backend and oracle 9ias as my web and app server.

     Do you know how to solve this problem? I am using JDBC and using resultset.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 6856126
Listening on this pattern...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:selvamtvl
ID: 6856143
Thanks for your initialization Venci75.

     I don't know how to access but i need help from someone like you. I am using oracle 8i as my backend and oracle 9ias as my web and app server.

     Do you know how to solve this problem? I am using JDBC and using resultset.
0
 
LVL 9

Accepted Solution

by:
Venci75 earned 100 total points
ID: 6856305
try this simple code:

<%
// creating connection to the DB
   java.sql.DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
   java.sql.Connection conn = java.sql.DriverManager.getConnection ("jdbc:oracle:oci8:@dbalias", "user", "pwd");
   java.sql.Statement stmt = conn.createStatement ();
   java.sql.ResultSet rset;
// check whether the result set has created.
// if so - reuse the existing one
   rset = (java.sql.ResultSet) session.getValue("rset");
   if (rset == null) {
// create result set - select query
     rset = stmt.executeQuery ("SELECT \"NAME\" AS title FROM MyTable");
     session.putValue("rset", rset);
   }
   for (int i = 0; i< 10; i++) {
     rset.next();
%>
  <%= rset.getString("title") %><br>
<%
  }
%>
<!-- 3.jsp is the name of my test jsp file. you shoud your jsp name in the href parameter -->
<a href="3.jsp">next 10</a><br>
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7901864
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: Venci75
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 7902656
Fine by me...
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7962641
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question