Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Pagination in Tabs  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add an extra request parameter which indicate the tab or so.
 
sudha murty
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Javascript to switch to the desired tab based on the request parameter.

E.g.or so.
 
Are we home yet? Wait, did we forget the tiny ad?
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!