File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes JSP Pagination in Tabs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Pagination in Tabs" Watch "JSP Pagination in Tabs" New topic
Author

JSP Pagination in Tabs

sudha murty
Greenhorn

Joined: Jan 23, 2009
Posts: 3
Hello,

I am implementing a logic wherein I have a couple of tabs in a JSP and each tab has its own data to be displayed. (Tabs implemented using css, javascript and jsp)
As the data is large, I have to display it using Pagination. I have implemented the same, but now the problem is,
-->The pagination works fine for the first tab, but when I click on any other, and see for next/prev page, the control goes to the 1st tab!! This is because I am setting a request paramenter as 'searchIndex' (e.g main.jsp?startIndex=13).
I am not able to decide how should I go for this logic?
Should I use altogether different jsps to be called when a tab is clicked?
Please help. Let me know if I have missed on some information which is needed.

Thanks,
Sudha
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Add an extra request parameter which indicate the tab or so.
sudha murty
Greenhorn

Joined: Jan 23, 2009
Posts: 3
Thanks. I did try that. But I am not able to open the tab dynamically according to the request parameter. I am using <div> tag for differentiating the tabs. I am sorry if the topic is getting dragged to somewhere it should not.
I have the code as follows:
<div class="testtab">
<ul class="testtabs">
<li><a href="#tab1">Tab1</a></li>
<li><a href="#tab2">Tab2</a></li>
<li><a href="#tab3">Tab3</a></li>
<li><a href="#tab4">Tab4</a></li>
<div>
<h2><a name="tab1" id="tab1">Tab 1</a></h2>
//logic for pagination
...
<a href="main.jsp?tabID=1&startIndex=<%=(k*numRecordsPerPage)+1%>"> <%=PageNumber %>

</div>

<div>
<h2><a name="tab2" id="tab2">Tab 2</a></h2>
//logic for pagination
...
<a href="main.jsp?tabID=2&startIndex=<%=(k*numRecordsPerPage)+1%>"> <%=PageNumber %>

</div>

.....
.....
</div>



As the pageNumber links in all the tabs call the same jsp, even if the tab id parameter is present, I am not able to use it.

Thank you,
Sudha
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Use Javascript to switch to the desired tab based on the request parameter.

E.g.or so.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP Pagination in Tabs