struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wilson, Les J SI-FSIA" <Les.L.Wil...@si.shell.com>
Subject RE: logic:iterate
Date Mon, 16 Dec 2002 08:20:50 GMT
Hi Cathy,

We use the jsptags pager as well and have not had any problems - we are
still using v1 of struts.  The jsp snippet below works without any blank
lines in the source - can't really see much difference between the two, only
the offset and the url seem to be different.

    <pg:pager maxPageItems="10" url="referenceDataListPager.do">
      <table cellspacing="0" cellpadding="2">
        <tr>
          <th width="30" align="left">
          </th>
          <th width="90" align="left">
              <strutsbean:message
key="page.referenceDataList.descriptionLabel"/>
          </th>
        </tr>
      
        <% boolean highlight = true; %>
        <strutslogic:iterate name="<%=CommonConstants.REFERENCE_DATA_LIST%>"

                             id="entry"
                             indexId="idx">
          <pg:item>
            <% highlight = !highlight; %>
            <tr <% if(highlight) { %> class="highlight" <% } %>>
              <td>
                <strutshtml:link href="<%= "referenceDataDetail.do?row=" +
idx %>">
                  View
                </strutshtml:link>
              </td>
              <td>
                <strutslogic:present name="entry" property="description" >
                  <strutsbean:write name="entry" property="description" />
                </strutslogic:present>
              </td>
            </tr>
          </pg:item>
        </strutslogic:iterate>
      </table>
      <pg:index>
        <font class="pager">Result Pages:</font>
        <pg:prev>
           <a class="pager" href="<%= pageUrl %>">[<< Prev]</a>
        </pg:prev>
        <pg:pages>
          <% if (pageNumber.intValue() < 10) { %>
             
          <% }
            if (pageNumber == pagerPageNumber) { %>
              <font class="pager"><%= pageNumber %></font>
          <% } 
          else { %>
            <a class="pager" href="<%= pageUrl %>"><%= pageNumber %></a>
          <% } %>
        </pg:pages>
        <pg:next>
           <a class="pager" href="<%= pageUrl %>">[Next >>]</a>
        </pg:next>
      </pg:index>
    </pg:pager>


Les Wilson

Shell Finance Services
Shell International Limited, Shell Centre, London SE1 7NA, United Kingdom
Email: Les.Wilson@shell.com
Internet: http://www.shell.com


-----Original Message-----
From: Cathy [mailto:hinbsls@yahoo.ca]
Sent: 15 December 2002 19:02
To: Struts Users Mailing List
Subject: logic:iterate


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

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message