Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to implement Pagination in JSP

 
rajen prasad
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All ,
I am using JSR168 portlets and MVC architecture to implement pagination portlet.

Anybody can you send me code to implement pagination in JSP???

What I am trying is when the user is not selected any page or the page is first time requested then I am displaying page no 1 .

Thanks in advance,
Rajendra.
[ September 01, 2006: Message edited by: Bear Bibeault ]
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're trying to control which pages they see when?

Maybe some state logic. Put a flag in the user' session. If the flag is true, show them page 1, if it's false, show them page 2. Figure out which condition to change the flag on.

Not sure if this is what you're asking. Remember, you should allow the portal to decide which pages to render as much as possible. That's the mind shift you must make when you move to portal. Trying to control pages in the portal is a difficult matter - thus the creation of things like Struts Portlets and JSF portlets.
 
rajen prasad
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
My scenario is like ---> When you search something in google then it should display some no of results in first page , next page , previous page . Like this I want to develop JSP .

Anyone can help me please

thanks in advance,
Rajendra Prasad
 
Pavan Kumar gorakavi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can implement your scenario as follows:

1. Have the pagination variable in property file, such that you can dynamically change the value.
2. create an class with Collection of search results, total results, currentPageNumber.
3. write a business logic by keeping track of on which page the user resides and pagination variable in property file.

This solution is universal in application, can be used in all portal environments.

-
Pavan Kumar Gorakavi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic