Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to control search result

 
Erwin Bredford
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,i am a jsp application but the problem is that the
how do i control the number of search results if it is too many for a page for example
if the a query on web application produces like 30 search results and i need 10 per page how do i do that could i get some code on how to do that
thank you
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chinedu, this is a commonly asked question. You can probably find some great ideas or a starting point by search this forum (as well as perhaps the Servlets and JDBC forums) for terms such as "paging" and "search results".
bear
 
Tim Baker
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whoever made this web application must have coded it with some pretty advanced AI for it to be able to post it's own problems on a coding forum.
 
vijaykumar shah
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello..
its very simple.. and more of logic then jsp question ..
let's say query is select id , name from atable;
this will fetch 100 records
save this records in the arraylist .. i.e id [primary key]
so total no. of records is 100
records per page = 10
total no. of page = 10
now u have to show page1 first...
for others show links 2,3,4 5,6,7,8,9,10
1 is inactive as we are showing first page..
now when there is a code of showing the records make a loop of 1 - 10
now when user click on 2 u are to display 11-20
so for start and end condition of the loop to display the records from the arraylist
write small code i.e equation to get start and end condition depending on page number
u are done
vijay
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic