File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Search pages shows only limited no. of rows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Search pages shows only limited no. of rows" Watch "Search pages shows only limited no. of rows" New topic

Search pages shows only limited no. of rows

Dhamayanthi Karuppanan
Ranch Hand

Joined: Oct 20, 2009
Posts: 31
Search pages shows only limited no. of rows, say, if 10 results per page, it is able to show 70 records (7 pages) and if 30 per page (shows only once) and next page leads to error. Common error message appears.

Detail of the issue: I have designed a "search page" to search by providing some / all of the employee details from the database. Once I click on "Search" button, i submit the page with "get" method. On the result page, I have called the java class which talks to dao and get the results. I return the results to jsp as a list.

As of now I show only 10 results per page, and I have next button to proceed and back to previous results. I have added start and end positions on the request, so I use them to pick records from that counts. I have written a query to get only 10 records at a time. if I press next, (next is a href and i have dynamic link which takes start and end positions) jsp calls java which talks to dao and gets results again.

sample request query string:

Problem here is: Totally I'm getting 4000 records (used separate query to count records) and i show 10 records per page. I'm able to continue till 70th record and after that I get a message saying some error.

If I try for 30/page, the first search result page is coming and for next 31to60 error page is coming
If I try for 50, the first search result page itself is not coming

I logged all the steps and it looks like, list is getting populated from database, and size also says 30 records.
below is my log:

I'm not getting any clue to solve this. Is there any restriction to use links on page. because, i make first column as a link, so for 50 rows i would have 50 links. may be insane, but the same is working for 7 pages if i have 10results / page.

Thanks for your time.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19868

But you are getting a clue. It's in the error message at the beginning of your post, and this is what it says:
Please consult the application log for details.

So your Java class is throwing an exception for some reason. At this point that's all you know. So it's too early to start speculating about what might be wrong and how to fix it; the first thing to do is to find the reason. And as the error message implies, you should look in your server's log files. Most likely you will find a stack trace saying what exception was thrown and what line of code threw it. Start looking for that.
Dhamayanthi Karuppanan
Ranch Hand

Joined: Oct 20, 2009
Posts: 31
Yes, There were errors. As there is no error handling in jsp, it was failing and writing to the application log. Thanks for pointing out!
I agree. Here's the link:
subject: Search pages shows only limited no. of rows
It's not a secret anymore!