Displaying 1000 records per page.

Hi Experts,
Currently we are displaying more than 1000 records per page in JSP and its taking around 25 minutes to display the page. So we want to only display 1000 per page and do prev or next for other records. Can anyone provide me with code to do this. I did search the forum but I got confused. If someone can provide step by step then it would be great. I am totally new to this and I have to get this done by Friday.

Thanks
Suketu
suketu9Asked:
Who is Participating?
 
fargoCommented:
Hi,

have a look here
http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_21777860.html

but i suspect, if the retrieval time of 1000 records is large, the above will not work.

Other option is to use the paging at the Database level. There is no such code available for it and u have to implement it on your own.

fargo
0
 
fargoCommented:
Other options are

display tags
http://displaytag.sourceforge.net/11/

Examples and tutorials are all there.

For the previous post, here is the links
Use Pagination tag
http://jsptags.com/tags/navigation/pager/index.jsp

Documentation on it
http://jsptags.com/tags/navigation/pager/index.jsp

regards,
fargo
0
 
jessegivyDeveloperCommented:
What kinda data do you have that it takes 25 minutes, or are you on a 14400 dial up connection ;)

If there's a bunch of large images, or files, then it could be a solution to show them as attachments.  How many fields are we talking about?

Sincerely,

Jesse
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
suketu9Author Commented:
Its just displays some data in the table format in jsp but the table has around 30000 plus data in it which it tries to display at once. So we want to display 1000 per page instead of all 30000 at once. Thanks!
0
 
suketu9Author Commented:
I am using DB2 as my Database. So please let me know what do i need to do to display 1000 per page in jsp. Please provide me with code to better understand. I went to jsptags.com but dont understand how to implement it in my code and what else I have to implement beside the page tag library. If anyone can tell me how to implement page tag library that would be great.

Thanks
0
 
fargoCommented:
Hi,

I asked you to take a look at the following link, i explained clearly what to do to make use of jsptags pager taglib.

have a look here
http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_21777860.html

In case of any questions, ask back.

fargo
0
 
massricoCommented:
Hi All

I faced this situation before and I Solved as the Following

<%
                  int nRecords =0, nPages =0, nFrom =0, nTo =0, nCurrentPage =1, nRecordsPerPage =1000;  

        // 0- Get Actual Current Page
      if(request.getParameter("nCurrentPage")!=null)
            nCurrentPage = Integer.parseInt(request.getParameter("nCurrentPage"));  
        else
                nCurrentPage = 1;

      
      // 1- get the Number of the Records
      rs = statement.executeQuery("SELECT  count(*) as nRec FROM viajes");
      rs.next();
      nRecords = rs.getInt("nRec");
      
      // 2- get total pages
      nPages= (nRecords/nRecordsPerPage) + 1;
      
      // 3- set Page Starting Record
      nFrom = (nCurrentPage-1) * nRecordsPerPage ;
       
        // 4- Show Rows
      rs = statement.executeQuery("SELECT viajes.ID, viajes.titulo FROM viajes where GROUP BY ID DESC LIMIT "+ nFrom + "," + nRecordsPerPage );      

%>

and for Next and Previous Buttons

*) Previous Button
                         <% if (nCurrentPage>1) {%><a href="ofertas.jsp?nCurrentPage=<%=(nCurrentPage-1)%>"></a><%}%>

*) Next Button
                        <% if (nPages > nCurrentPage) {%><a href="ofertas.jsp?nCurrentPage=<%=(nCurrentPage-1)%>"></a><%}%>


Khaled Ahmed
      


      
      
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.