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

how to control search result

Erwin Bredford
Ranch Hand

Joined: Feb 11, 2003
Posts: 167
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


--One learns a lot during a lesson but seeing is not enough,you must do;knowing is not enough ,you must apply--<br />SCJP 1.4,SCBCD,SCEA part 1,OCM JEE Enterprise Architect.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
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.


Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
vijaykumar shah
Greenhorn

Joined: Jul 02, 2003
Posts: 23
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to control search result