Pedro, (Posted here 'cos I couldn't get through to your email address.)
Refer to the taglib documentation at http://jsptags.com/tags/navigation/pager/pager-taglib-1.1.html I think you would have to do some arithmetic in your Action class and put the results into the request/session to achieve this. The 'pager' tag makes available a pagerPageNumber variable which is the page number of the current page. Internally the tag library classes must know how many rows and pages there are, but it does not expose these to the jsp as far as I can see. You would need to calculate the total number of rows which are to be displayed and put this into the request/session for the jsp to use. So, to get the total number of pages you would need to work out the no. of rows to display divided by the value specified for the maxPageItems attribute of the 'pager' tag (+1 if there is a remainder). The pagerOffset variable exposed by the 'pager' tag can be used to calculate the "Results 1 to 10" part of your requirement (pagerOffset +1 to pagerOffset+maxPageItems, unless this is the last page, in which case it would be pagerOffset +1 to total no. of rows). Another option would be to ask the author (James Klicman, I believe - [EMAIL PROTECTED]) to modify the tag classes to expose the variables you need ( I don't think this library is open source). HTH Malc -----Original Message----- From: Pedro Marques [mailto:[EMAIL PROTECTED]] Sent: 05 February 2002 22:15 To: [EMAIL PROTECTED] Subject: RE: paging taglib and struts? Malcolm, Is it possible to get the total number of pages? I would like a navigation bar like this: "Results 1 to 10 out of 1036 page 1/20" thanks, Pedro. -----Original Message----- From: Malcolm Wise [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 1:32 AM To: 'Struts Users Mailing List' Subject: RE: paging taglib and struts? 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> </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]> _____________________________________________________________________ INTERNET MAIL FOOTER A presente mensagem pode conter informação considerada confidencial. Se o receptor desta mensagem não for o destinatário indicado, fica expressamente proibido de copiar ou endereçar a mensagem a terceiros. Em tal situação, o receptor deverá destruir a presente mensagem e por gentileza informar o emissor de tal facto. --------------------------------------------------------------------- Privileged or confidential information may be contained in this message. If you are not the addressee indicated in this message, you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. --------------------------------------------------------------------- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>