aspose file tools*
The moose likes JSP and the fly likes Pagination Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Pagination " Watch "Pagination " New topic
Author

Pagination

maganti suryanarayana
Ranch Hand

Joined: Mar 30, 2010
Posts: 53

How to do pagination in JSP ?


surya
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 998
    
  13

That's not much information to go on, but I'll take a guess that you want to display a table and limit the number of rows on the page. I've used JQuery and DataTables for this.

Can you tell us more about what you are trying to accomplish and what you've tried so far? Is using JavaScript an option or do you need to do it all server-side?


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
maganti suryanarayana
Ranch Hand

Joined: Mar 30, 2010
Posts: 53

Thanks Robbins. I want to know how to do it in javascript. I am using Mysql as database, Struts as UI.
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 998
    
  13

Start by looking at this jQuery plugin http://datatables.net/. There are lots of examples and decent support in the forums. Make your best attempt at it and when you run into problems come back here and post your code and explain the problem clearly.

You need to understand that nobody here is going to write the code for you. We're glad to help out, but only if you show some effort.
jhon masco
Ranch Hand

Joined: May 13, 2010
Posts: 93
maganti suryanarayana wrote:How to do pagination in JSP ?


HI
Here a nice example. Without frameworks or Scripts.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

jhon masco wrote:
Here a nice example. Without frameworks or Scripts.

Nice example? It's horrible! It violates every good practice known to mankind.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

Bear Bibeault wrote:
jhon masco wrote:
Here a nice example. Without frameworks or Scripts.

Nice example? It's horrible! It violates every good practice known to mankind.

It's like watching a horror movie
Senthil Manoharan
Greenhorn

Joined: Mar 01, 2010
Posts: 28
You can try Yahoo UI pagination....


Thanks and Regards
Senthil Kumar M
Sabarish Venkat
Ranch Hand

Joined: Jan 18, 2012
Posts: 136

hi maganti,

here is a set of codes for you try to add your own codes inside it along with the code

jhon masco
Ranch Hand

Joined: May 13, 2010
Posts: 93

Nice example? It's horrible! It violates every good practice known to mankind.


It like me because tell with details how pagination works.
I guess all the scripts and frameworks use the same metodology.
I suppose he know that he can not work with databases inside JSP pages.!!! I just wanted to show the methodology.

Salutes

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

jhon masco wrote:I just wanted to show the methodology.

But the shown methodology is horrible and should not be followed.
jhon masco
Ranch Hand

Joined: May 13, 2010
Posts: 93
Bear Bibeault wrote:
jhon masco wrote:I just wanted to show the methodology.

But the shown methodology is horrible and should not be followed.


That means than not exist a way without script or frameworks??? Why this methodology is wrong???
I am curious!!!

PD: I was looking the Sabi Swa's code and it follow this methodology.!

Thanks
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
I got one word for ya: DisplayTag
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

jhon masco wrote:Why this methodology is wrong?


Because it uses many poor practices. Not only does it use scriptlets and Java code in a JSP, it actually performs the DB access in the JSP! This is an egregious violation of everything that is considered a good practice.
jhon masco
Ranch Hand

Joined: May 13, 2010
Posts: 93
Because it uses many poor practices. Not only does it use scriptlets and Java code in a JSP, it actually performs the DB access in the JSP! This is an egregious violation of everything that is considered a good practice.


Yes, i know that!!!
I just want show how is the process.
Then i dont must say "methodology" , i must say "algorithm".

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

You're missing the point. Showing how to do it wrong is not helpful. It just makes people think that that's a good way of doing it when it's not. It's like teaching someone to cook something and saying "Here's the wrong way of doing it. Now figure out on your own what the right way is".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pagination