File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes display tag pagination problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "display tag pagination problem" Watch "display tag pagination problem" New topic
Author

display tag pagination problem

ganesh pol
Ranch Hand

Joined: Apr 29, 2005
Posts: 151
i have following code for display tag


<display:table name="users"
id="user"
class="dataTable"
export="true"
pagesize="10"decorator="org.displaytag.decorator.TotalTableDecorator">
<display:column title="Record Number" headerClass="th1" class="cellText">
<%=pageContext.getAttribute("user_rowNum")%>
</display:column>
<display:column property="firstName" title="firstName" maxLength="10" headerClass="th1" class="cellText" />
<display:column property="middleName" headerClass="th1" class="cellText"/>
<display:column property="lastName" headerClass="th1" class="cellText"/>
<display:column property="email" headerClass="th1" class="cellText"/>
<display:column property="age" headerClass="th1" class="cellText"/>
<display:column property="dateOfJoin" headerClass="th1" class="cellText"/>
<display:setProperty name="paging.banner.placement" value="bottom" /></display:table>


code in the bold font is used for moving to next page

but when i click on next page i got following exception
in browser

org.apache.jasper.JasperException: fromIndex = -10
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause is
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.view.List_jsp._jspService(List_jsp.java:240)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


i am using display tag 1.1.jar



can any one help me to solve this problem
ganesh pol
Ranch Hand

Joined: Apr 29, 2005
Posts: 151
This is reply to my post

now my code works fine


i have made some changes in my jsp code which my tagLibs Guru Mahesh has explained me some time before




<%
String requestURI="request.getContextPath()/a.c";
%>


<display:table name="users"
id="user"
class="dataTable"
export="true"
requestURI="<%=requestURI%>"
requestURIcontext="true"
pagesize="2"
decorator="org.displaytag.decorator.TotalTableDecorator">
<display:column title="Record Number" headerClass="th1" class="cellText">
<%=pageContext.getAttribute("user_rowNum")%>
</display:column>
<display:column property="firstName" title="firstName" maxLength="10" headerClass="th1" class="cellText" />
<display:column property="middleName" headerClass="th1" class="cellText"/>
<display:column property="lastName" headerClass="th1" class="cellText"/>
<display:column property="email" headerClass="th1" class="cellText"/>
<display:column property="age" headerClass="th1" class="cellText"/>
<display:column property="dateOfJoin" headerClass="th1" class="cellText"/>
<display:setProperty name="paging.banner.placement" value="bottom" />
</display:table>


where requestURI is nothing but my controllers url mapping


which i did in web.xml as

<servlet-mapping>
<servlet-name>displayTagTest</servlet-name>
<url-pattern>*.c</url-pattern>
</servlet-mapping>

a.c is url mapping of my controller from where i got list
[ November 24, 2006: Message edited by: ganesh pol ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: display tag pagination problem
 
Similar Threads
not able to read records from mysql database
display tag export problem
exception in validation mechanism
Exception in struts Application
struts exception