Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

JSP Pagination for search results produced by search engine  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All! I have built a search engine for searching scientific documents. However, I am facing problem in pagination. My simple question is that all my results for a query are stored in 3d array:  Document   Score    Path. I want to display the results in multiple pages.
Many a topics discussed in this forum concern displaying results obtained from database. But my situation is different. I have retrieved all the results in a 3-d array. I just want to display them. Kindly help me on this.

Thanks!
 
Marshal
Posts: 67192
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you fetch all the results? That's not going to scale well. Is it not possible for you to only fetch a page's worth of data at a time? That'd be most efficient as well as well as easier to deal with.
 
Amarnath Pathak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey! Bear Bibeault. Thanks! Actually that's not my concern. I will change it later on. I just want to know how to display already fetched results in different pages.
 
Bear Bibeault
Marshal
Posts: 67192
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would be best then (assuming you cannot pre-page the data) is to transform the data to a simple list (assuming that's what you will display) in the page controller rather than in the JSP itself. It's best to keep the JSPs as "dumb" as possible and do all the heavy lifting in Java code in the controllers.
 
Amarnath Pathak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please share a small piece of code? Actually I am stuck with it since long. I tried different possibilities but all in vain.
 
Saloon Keeper
Posts: 5124
135
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An easy approach would be to use a library like http://hazendaz.github.io/displaytag/ that creates the table display and also does the paging for you.
 
Bear Bibeault
Marshal
Posts: 67192
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Amarnath Pathak wrote:I will change it later on.


What I don't understand is all the time you are going to spend dealing with breaking up the large dataset when you are just going to have to throw it all away later when you change how the data gets fetched. It's clearly not something that's trivial, why not just do it the right way from the beginning?
 
Hang a left on main. Then read this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!