struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cathy" <hinb...@yahoo.ca>
Subject logic:iterate
Date Sun, 15 Dec 2002 19:02:04 GMT
Hi:

Have you used pager tag library from http://jsptags.com/tags/navigation/pager/
with logic:iterate tag? I am using them together, and I have a problem. Please help me if
you know what's going on in the following problem. I really appreciate your help.(Rick suggested
me to use display tag from http://edhill.its.uiowa.edu/display-0.8/. I had a look. And it's
excellent. However, the project is almost in production phase, I prefer to fix the problem
based on what I have now instead of changing the implementation. Thank Rick, anyway).


I retrieved 23 rows from Database, and I saved the data in session. I want to display the
data on 10 rows/page basis with page navigation ability.So on the first page, there are 10
rows and a "next" link, On the second
page, there are 10 rows and  "previous" and "next" link. On the third page, there are 3 rows
and a "previous" link. I used logic:iterate to iterate through the data, and use pager tag
library from the above link to implement the page navigation ability.The following is my jsp
snippets:

<%@ taglib uri="/WEB-INF/pager-taglib.tld" prefix="pg" %>
    ......

<pg:pager maxPageItems="10" isOffset = "true">
   <logic:iterate id="aResult" name="results" scope="session" type="com.test.Result">
        <pg:item>
           <tr>
                 <td>
                      <bean:write name="aResult" property="note"/>
                 </td>

             <logic:notEqual name="aResult" property="amount" value="0">
                 <td>
                     <bean:message key="amount.value"/></font></div>
                 </td>
             </logic:equal>
           </tr>
        </pg:item>
   </logic:iterate>

    <-- page navigation area-->
</pg:pager>

Page navigation works fine(I mean when I click "next" or "previous", it goes to next or previous
page. So I omitted the page navigation snippest. The problem is: when the first page is displayed,
I viewed the source of the first page, there are 10 blank rows before the line " <-- page
navigation area-->" -- I mean there is a big spaces which is equal to 10 rows, between
the last row and the line " <-- page navigation area-->". After I click "next" link
and opened the second page, I viewed the source, I found between the last row on the page
and  the line "<-- page navigation area-->", there are 3 blank rows(because the next
page has 3 rows). When I opened the third page(last page), and viewed source, there is no
blank row(because there is no next page).

In order to solve the problem, I searched the archive and the web. I found lot of disussion
about paging. But there seems no discussion about the blank rows problem. Could you help me
out here. I spend a lot of time trying to fix it, but no clue. I really appreciate your help.

Thank you very much.

Cathy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message