You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Cathy Osekizoglu <hi...@yahoo.ca> on 2002/12/13 19:59:33 UTC

logic:iterate

Hi:
I have 12 items in a collection. I want to display the first 10 items on the first page, and the rest 2 items in the next page. How can I control it using logic:iterate tag. Thank you for your help.
Regards,
Cathy



---------------------------------
Post your free ad now! Yahoo! Canada Personals

Re: logic:iterate

Posted by Rick Reumann <ma...@reumann.net>.
On Sat, 14 Dec 2002 16:32:07 -0500
"Cathy" <hi...@yahoo.ca> wrote:
  
> I am using pager tag library from
> http://jsptags.com/tags/navigation/pager/ 

I use the display tag here 
http://edhill.its.uiowa.edu/display-0.8/
and it works great. Very easy to use also.


-- 
Rick

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: logic:iterate

Posted by Cathy <hi...@yahoo.ca>.
Thank you for all your reply.

I am using pager tag library from http://jsptags.com/tags/navigation/pager/
with logic:iterate tag. 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 is "next" link, On the second
page, there is "previous" and "next" link. On the third page, there is
"previous" link. I use logic:iterate to iterate through the data, and use
page tag library from the above link to implement the page navigation
ability.The following is my jsp snippest:

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





----- Original Message -----
From: "Affan Qureshi" <qu...@etilize.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Saturday, December 14, 2002 12:37 AM
Subject: Re: logic:iterate


> You can do it manually by keeping the collection and state variables in
the
> session which indicate the page nos and the current status of the
> collection. However there are some Tag Libraries available taht do just
> that. Check out Struts-Layout and Ed Hill's TagLibs on the Struts
resources
> page.
>
> Affan
>
> ----- Original Message -----
> From: "Cathy Osekizoglu" <hi...@yahoo.ca>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Friday, December 13, 2002 11:59 PM
> Subject: logic:iterate
>
>
> >
> > Hi:
> > I have 12 items in a collection. I want to display the first 10 items on
> the first page, and the rest 2 items in the next page. How can I control
it
> using logic:iterate tag. Thank you for your help.
> > Regards,
> > Cathy
> >
> >
> >
> > ---------------------------------
> > Post your free ad now! Yahoo! Canada Personals
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: logic:iterate

Posted by Affan Qureshi <qu...@etilize.com>.
You can do it manually by keeping the collection and state variables in the
session which indicate the page nos and the current status of the
collection. However there are some Tag Libraries available taht do just
that. Check out Struts-Layout and Ed Hill's TagLibs on the Struts resources
page.

Affan

----- Original Message -----
From: "Cathy Osekizoglu" <hi...@yahoo.ca>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, December 13, 2002 11:59 PM
Subject: logic:iterate


>
> Hi:
> I have 12 items in a collection. I want to display the first 10 items on
the first page, and the rest 2 items in the next page. How can I control it
using logic:iterate tag. Thank you for your help.
> Regards,
> Cathy
>
>
>
> ---------------------------------
> Post your free ad now! Yahoo! Canada Personals
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>