[ http://jira.codehaus.org/browse/DISPL-366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=133534#action_133534 ]
tasos zervos commented on DISPL-366: ------------------------------------ The code in org.displaytag.pagination.SmartListHelper.setCurrentPage(int pageNumber) (line 240) else if (pageNumber != 1 && pageNumber > this.pageCount) { // invalid page: set to last page this.currentPage = this.pageCount; } sets this.currentPage=0 when the list has no data (this.pageCount==0). Please update to something like: else if (pageNumber != 1 && pageNumber > this.pageCount) { // invalid page: set to last page (unless last page equals 0!) if (this.pageCount == 0) { this.currentPage = 1; } else { this.currentPage = this.pageCount; } } This also covers DISPL-393. > I am recieving a "java.lang.IndexOutOfBoundsException: fromIndex = -10" error > while trying to use the sort/pagination functionality of display tag 1.1. > --------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: DISPL-366 > URL: http://jira.codehaus.org/browse/DISPL-366 > Project: DisplayTag > Issue Type: Bug > Components: Paging/Sorting > Affects Versions: 1.1 > Reporter: ksandhu > > I have two jsp pages : the first is titled customer_search.jsp and the second > is customer_details.jsp. > From customer_search.jsp, the user enters their customer search criteria. > java.util.List searchResults; > searchResults = customer.getCustomers(); > //set session and forward page > session.setAttribute("searchResults",searchResults); > <jsp:forward page="customer_details.jsp" /> > I pass in the sessionVariable "searchResults" which is an ArrayList into my > customer_details.jsp page. > java.util.List customerList = > (java.util.List)session.getAttribute("searchResults"); > %> > <jsp:scriptlet> request.setAttribute( "test", customerList); </jsp:scriptlet> > <% > %> > <pre> > > <display:table name="sessionScope.searchResults" class="its" pagesize="10"> > <display:column property= "account_no" title="Account No" /> > <display:column property= "customer_name" title="Customer Name"/> > <display:column property= "contact_name" title="Contact Name"/> > <display:column property= "contact_phone" title="Phone Number"/> > <display:column property="link2" title=" " /> > </display:table> > The search results appear fine but when I click on the page links at the top, > I get an Index out of bounds exception. Heres the root cause from tomcat: > java.lang.IndexOutOfBoundsException: fromIndex = -10 > java.util.SubList.<init>(AbstractList.java:703) > java.util.RandomAccessSubList.<init>(AbstractList.java:861) > java.util.AbstractList.subList(AbstractList.java:570) > > org.displaytag.pagination.SmartListHelper.getListForPage(SmartListHelper.java:219) > > org.displaytag.pagination.SmartListHelper.getListForCurrentPage(SmartListHelper.java:200) > org.displaytag.tags.TableTag.setupViewableData(TableTag.java:1525) > org.displaytag.tags.TableTag.doEndTag(TableTag.java:1198) > > org.apache.jsp.admin.customer_005fdetails_jsp._jspx_meth_display_table_0(customer_005fdetails_jsp.java:368) > > org.apache.jsp.admin.customer_005fdetails_jsp._jspService(customer_005fdetails_jsp.java:203) > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) > javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) > javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > > org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ displaytag-devel mailing list displaytag-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-devel