RE: paging taglib and struts?
Malcolm I've been reading throughthe documentation for the taglib, and I'm getting the impression that the collectionof things I'm interating over has to exist in it's entirety in server memory. Is that true? This is slightly problematic for me because it's a large collection of data (I know, I should push back on the user...it's along story) My questions are 1. how does it know what the collection is that I'm iterating through 2. what are you using the pg:param name=action value=search/ for? currently ,y I've included my jsp for reference... Any help is appreciated. John Mattos Sr. Developer and Architect iNDEMAND 345 Hudson St. 16th Floor New York, New York 10014 --- My JSP--- pg:pager TABLE border=1 TBODYtr th colspan=13 align=centerView Valid Transactions/th/tr TR TR ThType/Th ThStatus/Th ThOrg Id/Th ThOrg Name/Th ThChannel/Th ThProduct Title/Th ThSignal Type/Th ThEvent #/Th ThDeal/Th ThRetail/Th ThBuys/Th ThAmount Due/Th ThPost Date/Th /TR pg:item logic:iterate id=buyTransaction type=com.indemand.indab.application.invoice.BuyTransaction collection=%=valids% TR TD ALIGN=LEFT%=buyTransaction.getType()%nbsp;/TD TD ALIGN=LEFT%=buyTransaction.getStatus()%nbsp;/TD TD ALIGN=RIGHT%=buyTransaction.getOrgId()%/TD TD ALIGN=LEFT%=buyTransaction.getAffiliateFullName().trim()%nbsp;/TD TD ALIGN=RIGHT%=buyTransaction.getChannel()%nbsp;/TD TD ALIGN=LEFT%=buyTransaction.getAssetTitle()%nbsp;/TD TD ALIGN=CENTER%=buyTransaction.getTiertype()%nbsp;/TD TD ALIGN=RIGHT%=buyTransaction.getIndAsstId()%nbsp;/TD TD ALIGN=RIGHT%=buyTransaction.getDealTerm()%nbsp;/TD TD ALIGN=RIGHT$%=buyTransaction.getTransAmt()%nbsp;/TD TD ALIGN=RIGHT%=buyTransaction.getBuys()%nbsp;/TD TD ALIGN=RIGHT$%=buyTransaction.getTotalTransAmt()%/TD TD ALIGN=CENTER%=buyTransaction.getPostDate()%nbsp;/TD /TR /logic:iterate /pg:item TR TD colspan=13 Align=centernbsp; pg:index pg:prev a href=%= pageUrl %[ (%= pageNumber %) Previous ]/a /pg:prev pg:pages a href=%= pageUrl %%= pageNumber %/a /pg:pages pg:next a href=%= pageUrl %[ Next (%= pageNumber %) ]/a /pg:next /pg:index /pg:pager /TD /TR /table --- END --- -Original Message- From: Malcolm Wise [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 4: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
RE: paging taglib and struts?
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. Thanks for the tip. The pager docs don't actually say this it is sorta assumed. Docs could be alot better. -Original Message- From: Malcolm Wise [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 9:31 AM To: 'Struts Users Mailing List' Subject: RE: paging taglib and struts? 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 1036page 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 TDbean:write name=row property=string[1]//TD TDbean:write name=row property=string[2]//TD TDbean:write name=row property=string[3]//TD TDbean:write name=row property=string[4]//TD /TR /pg:item /logic:iterate /TABLE TABLE width=60% border=0 TRTDnbsp;/TD/TR TR align=center TD pg:index pg:preva 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
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 TDbean:write name=row property=string[1]//TD TDbean:write name=row property=string[2]//TD TDbean:write name=row property=string[3]//TD TDbean:write name=row property=string[4]//TD /TR /pg:item /logic:iterate /TABLE TABLE width=60% border=0 TRTDnbsp;/TD/TR TR align=center TD pg:index pg:preva 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:nexta 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]
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]