• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JSP Pagination in Tabs

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use Javascript to switch to the desired tab based on the request parameter.

E.g.or so.
 
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic