This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
i am qureying an oracle database and i want to display the results in a table having only 20 rows ,the next 20 rows should be displayed in the next page and so on and depending on the number of rows dynamic links should be generated say as we have in google search,could some one help me out with the logic/URL'S etc.any replies would be welcomed....
As far as i see, there is no concept of disjointed recordsets in JDBC. Hence one has to create a kind of caching to achieve this. Previosly i had done this by maintaining a display counter variable in a session bean(which is toggled through the jsp's href), and fetching every time only that results that are defined by counter variable + FETCH_COUNT(say 20). The problem with this was..even though i show only 20 at a time i had to still go through the whole resultset when user browses more than 20 results... Another way is to serialize the results into a file and serve 20 from the file...but this leads to threading issues when on EJB servers.. Hope this gets u going and maybe someone might have better ideas..
Joined: Aug 06, 2001
Hello Manjunath, thanx a lot for the reply, But as far is EJB is concerned I am totally blank,Is this the way normal search engines like Google do it,please reply back
Originally posted by amit malhotra: Hello Manjunath, thanx a lot for the reply, But as far is EJB is concerned I am totally blank,Is this the way normal search engines like Google do it,please reply back
Hi, The way I did this is: When you get the results from the JDBC or any other call, store the results in a vector and a current index variable in the session (the index variable is to indicate the last row that is being displayed). If you are currently going forwar in the resultset, this will be the last row displayed among the 20 rows. If you are going backwards, this will be the first row among the 20 rows. Give the users choice to get the previous 20 results or the nex 20 results. The URL for forward or reverse should have a flag that indicates to the JSP what to do (reverse or forward). Based on which link they click, use the vector in the session, current index variable in the session and just decrement or increment from the index variable and show those elements from the vector. Also make sure you update the index variable to indicate the current position of the access. Hope this helps. Bala.