1

hello there i got a problem with pagination with sublist.. right know i can load the first 50 data from data..but when i click "2" link to load other page its doesnt load anything i notice that my code is use from and to and it will load only from and to..but how to increment from and to???can anyone give me some example..

here is the example

int from= 0;
int to = 50;
List subList = logList.subList(from, to);

//pagination 
if (logList.size()>50){

setTotalSessionRecord(logList.size());
int sessionCountPages = (logList.size()/subList.size());
if ((logList.size() % subList.size()) > 0) {
    sessionCountPages++;
}
setTotalSessionPage(sessionCountPages);

if (getSessionPage() == 0) {
    setSessionPage(1);
} else if (getSessionPage() > getTotalSessionPage()) {
    setSessionPage(getTotalSessionPage());
}

int startPages = (getSessionPage() - 1) * logList.size();
startPages++;

arg = new ArgumentBuilder();
arg.addArg(getSessionLogId());
arg.addArg(startPages);
arg.addArg(logList.size());
arg.addArg(isAsCending());
//end of pagination

in my jsp

function toSessionPage(sessionPage, ascOrderSession , id, 
  folderId , numberOfSessions , selectedSessionPages) {     
    var tURL = '<%=request.getContextPath()%>/home/Folder.action?
       listSessionLogEvents=&sessionLogId=' + id + '&folderID=' + folderId  + 
       '&sessionPage=' + sessionPage + '&numberOfSessionPages='+ numberOfSessions 
       + '&selectedSessionPages=' + selectedSessionPages 
       + '&asCending=' + ascOrderSession ;
    jQuery.ajax({
    url: tURL,
    dataType: 'html',
    success: function(returnData) {
        jQuery('#detailTR' + id).html(returnData);
    }
});
}

function toSelectedSessionPages(sessionPage, selectedSessionPages, 
             ascOrderSession,id ,folderId) {        
   var tURL = '<%=request.getContextPath()%>/home/Folder.action?
       listSessionLogEvents=&sessionLogId=' + id + '&folderID=' + "11" 
       + '&sessionPage=' + sessionPage + '&selectedSessionPages=' 
       + selectedSessionPages +'&asCending=' + ascOrderSession ;
    jQuery.ajax({
    url: tURL,
    dataType: 'html',
    success: function(returnData) {
        jQuery('#detailTR' + id).html(returnData);
    }
});
}

in load jsp..

<td align="center" width = "60%" >                          
Page:                         
<% 
   int toSessionPage = 0;                                   
    if(fa.getTotalSessionPage() - fa.getNumberOfSessionPages() > 20){
      toSessionPage = fa.getNumberOfSessionPages() + 19;                                        
    }else{
      toSessionPage = fa.getTotalSessionPage();
    }                                   
    int i = 0;
    for ( i= fa.getSelectedSessionPages(); i <= toSessionPage; i++) { 
        if (fa.getSessionPage() == i) {%>
        <font class="selectedPage"><%=i%></font>
    <%  } else { %>
        <a href="javascript:toSelectedSessionPages(<%=i%>,${actionBean.selectedSessionPages},
     '${actionBean.asCending}', '${actionBean.sessionLogId}')">
     <font class="unselectedPage"><%=i%></font></a>
    <% }
    if(i != toSessionPage) { %><font class="unselectedPage">|</font><% }
      } fa.setNumberOfSessionPages(i); %>
  </td>
Vinoth Krishnan
  • 2,925
  • 6
  • 29
  • 34
Putra
  • 49
  • 1
  • 1
  • 8
  • **Do not write** scriptlets in JSP, because scriptlets shouldn't be used in JSPs for more than a decade. Learn the JSP [EL](http://stackoverflow.com/tags/el/info), the [JSTL](http://stackoverflow.com/tags/jstl/info), and use servlet for the Java code. [How to avoid Java Code in JSP-Files?](http://stackoverflow.com/q/3177733/1031945) – Aniket Kulkarni Dec 30 '13 at 06:14
  • okay thanks for the info..so rite know how can i increment from and to to load others data?? – Putra Dec 30 '13 at 07:04

0 Answers0