John,

I am using this taglib quite extensively and it works very well with Struts.
Below is a fairly basic example jsp.
Essentially, the pager url attribute specifies the destination when any of
the navigation links is clicked.  Request parameters required by the action
class can be specified using the param tag.  These can be literals
(value="search") as in my example or use <bean:define> and specify the value
attribute as the resulting variable (value="<%=expr%>").  The item tag
defines each row to be displayed, and needs to be enclosed within
<logic:iterate>.  The index tag defines the navigation bar (prev, next etc)
as a series of hyperlinks.  The maxIndexPages attribute of the pager tag
defines how many page numbers will be displayed in the navigation bar, i.e
the below example will display

        [<<Prev] 1 2 3 4 5 6 7 8 9 10 [Next>>]

assuming there are 10 pages worth of data.  [<<Prev] and [Next>>] only
display if there are previous or more pages.  The maxPageItems attribute
specifies how many detail rows per page to be displayed.

I'm happy to answer any further questions or give examples.

Cheers
Malc

<pg:pager url="AdvancedSearch.do" maxIndexPages="10" maxPageItems="15">
  <pg:param name="action" value="search"/>
    <TABLE width="100%">
       <TR>
           <TD align="center">
               <TABLE width="60%" border="0">
                 <TR>
                    <TH width="10%"><bean:message
key="partnum.ecnsearchresults.ecnid"/></TH>
                    <TH width="20%"><bean:message
key="partnum.ecnsearchresults.model"/></TH>
                <TH width="10%"><bean:message
key="partnum.ecnsearchresults.releasedate"/></TH>
                <TH width="10%"><bean:message
key="partnum.ecnsearchresults.status"/></TH>
             </TR>
             <logic:iterate id="row" name="results" scope="request"
type="com.sony.sde.sql.Row">
                <pg:item>
                   <TR>
                      <TD><bean:write name="row" property="string[1]"/></TD>
                      <TD><bean:write name="row" property="string[2]"/></TD>
                      <TD><bean:write name="row" property="string[3]"/></TD>
                      <TD><bean:write name="row" property="string[4]"/></TD>
                   </TR>
                </pg:item>
             </logic:iterate>
          </TABLE>
              <TABLE width="60%" border="0">
             <TR><TD>&nbsp;</TD></TR>
             <TR align="center">
                 <TD>
                    <pg:index>
                    <pg:prev><a href="<%=pageUrl%>">[<< Prev]</a>
                    </pg:prev>
                    <pg:pages>
                       <bean:define id="pageNo" 
value="<%=pagerPageNumber.toString()%>"/>
                       <logic:equal name="pageNo" value="<%=pageNumber.toString()%>">
                           <%=pageNumber%>
                       </logic:equal>
                       <logic:notEqual name="pageNo" 
value="<%=pageNumber.toString()%>">
                           <a href="<%= pageUrl %>"><%= pageNumber %></a>
                       </logic:notEqual>
                             </pg:pages>
                             <pg:next><a href="<%= pageUrl %>">[Next >>]</a>
                     </pg:next>
                      </pg:index>
                      </TD>
                   </TR>
                </TABLE>
             </TD>
          </TR>
       </TABLE>
</pg:pager>

-----Original Message-----
From: John Menke [mailto:[EMAIL PROTECTED]]
Sent: 03 March 2002 02:08
To: struts-user
Subject: paging taglib and struts?


Does anyone any suggestions for implementing paging with struts? I have
searched the archive and karl basel posted this:

<snip>

There's a good pager taglib at jsptags.com. I've used it in a struts app and
does the job quite well when embedded in the iterate tags.

<logic:iterate>
   <pg:item>
           Item Details
   </pg:item>
</logic:iterate>

<snip>


I have downloaded this pager and the documentation is not providing enough
information on how this works.  Are there any examples out there on how to
do this that I am missing?

-john


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



*************************************************************************
The information contained in this message or any of its
attachments may be privileged and confidential and intended 
for the exclusive use of the addressee. If you are not the
addressee any disclosure, reproduction, distribution or other
dissemination or use of this communication is strictly prohibited
*************************************************************************

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to