[ http://jira.codehaus.org/browse/DISPL-334?page=comments#action_74106 ] 
            
Barry Lagerweij commented on DISPL-334:
---------------------------------------

I tried the patch as well, but it screwed up the results of page 2 and further: 
Page 2 only displayed results that used a 'property=' for the column, and 
ignored the contents of the tag 'display:column'. Furthermore, for the results 
it *DID* display, it always showed the results of page 1 (!). So although the 
patched looked promising, the end result was not what I expected.

I did however find a different solution: The two <display:table> elements were 
using the same value for the 'id' attribute, which was causing the mixup of the 
two instances. Changing the id of the second <displaytag:table> solved my 
problems.

> display:table pagesize="xx"  attrinute fail with multiple tables in same JSP
> ----------------------------------------------------------------------------
>
>                 Key: DISPL-334
>                 URL: http://jira.codehaus.org/browse/DISPL-334
>             Project: DisplayTag
>          Issue Type: Bug
>          Components: Tag Library
>    Affects Versions: 1.1
>            Reporter: Knut Erik Ballestad
>             Fix For: 1.1.1
>
>         Attachments: SmartListHelper.java.patch
>
>
> _display:table name="requestScope.purchaseItems_list" class="tab" 
> pagesize="6"_
> I have 2 tables underneath each other in a data mining-like web application.
> The tables resides in different JSP fragment files that are included from a 
> main JSP page.
> If the bottom table are sent an empty list, displaytag crashes (but only if 
> the pagesize attribute exist in the JSP).
>  - if the bottom list contains data, everything is OK
>  - if the bottom list JSP doesn't use the pagesize="x" attribute, everything 
> is OK
> Example (Bottom list is empty, and pagesize="6"):
> -results in this stack trace:
> 15:16:59,075 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
> java.lang.IndexOutOfBoundsException: fromIndex = -6
>       at java.util.SubList.<init>(AbstractList.java:703)
>       at java.util.RandomAccessSubList.<init>(AbstractList.java:861)
>       at java.util.AbstractList.subList(AbstractList.java:570)
>       at 
> org.displaytag.pagination.SmartListHelper.getListForPage(SmartListHelper.java:219)
>       at 
> org.displaytag.pagination.SmartListHelper.getListForCurrentPage(SmartListHelper.java:200)
>       at org.displaytag.tags.TableTag.setupViewableData(TableTag.java:1525)
>       at org.displaytag.tags.TableTag.doEndTag(TableTag.java:1198)
>       at 
> org.apache.jsp.list.PurchaseItems_jsp._jspService(org.apache.jsp.list.PurchaseItems_jsp:696)
> From debugging SmartListHelper:
> line 166:
>   return (pageNumber - 1) * this.pageSize;
> line 217-219:
>   int firstIndex = getFirstIndexForPage(pageNumber);
>   int lastIndex = getLastIndexForPage(pageNumber);
>   return this.fullList.subList(firstIndex, lastIndex + 1);
> When line 217 call line 166, and there are no pages (pageNumber=0), the 
> returned index is (-1 * 'the defined pagesize from JSP'),
> which results in the stack trace above

-- 
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

        

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
displaytag-devel mailing list
displaytag-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to