Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 427
  • Last Modified:

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
0
suketu9
Asked:
suketu9
2 Solutions
 
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
 
jessegivyCommented:
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
Technology Partners: 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!

 
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now