Yeah, it occurred to me as well... except I was hoping (maybe naively) to keep the GUI formatting to the GUI side, so that I don't have code that does things for only one view (since if a different format of paging is needed, we need to make changes to an actual class versus JSP code (albeit WW).
Thank you for your suggestion. It's probably the best approach (and simplest)... I'll code it up! Cheers, James > -----Original Message----- > From: Jason Carreira [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 13, 2003 11:10 AM > To: [EMAIL PROTECTED] > Subject: RE: [OS-webwork] webwork.util.Counter example > > > This sounds like an excellent opportunity for a reusable component to > manage this, if you want to build one :-) We've got one here at work > that does this, but it's tied in with other code we've got, so it > wouldn't be that easy to pull out. > > Jason > > > -----Original Message----- > > From: James Pan [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, August 12, 2003 12:47 PM > > To: [EMAIL PROTECTED] > > Subject: [OS-webwork] webwork.util.Counter example > > > > > > Hi, > > > > I have a page where I display a list of search results, > > showing 10 records. At the top of the page, I have > > "Previous", "Next" buttons that will change the pageIndex up > > or down. Basically, it looks like this: > > > > > > First | Previous | 1 2 3 4 5 | Next | Last > > > > > > And the user can navigate the search results. > > > > I do the page listing part (1 2 3 4 5) as follows: > > ------------------------------------------------------- > > <webwork:bean name="'webwork.util.Counter'"> > > <webwork:param name="'last'" value="@pageCount"/> > > <webwork:iterator id="colcount"> > > <a href="main.jsp?page=<webwork:property />"> > > > > <webwork:if test="../page==."><font > > id="bigblack"></webwork:if> > > <webwork:else><font > > id="smallblack"></webwork:else> > > > > <webwork:property /></font></a> > > > > </webwork:iterator> > > </webwork:bean> > > ------------------------------------------------------- > > > > The problem with this approach is that, if there are 50 > > pages, it'll list 1 to 50... which is not what i want... > > > > The page listing should only go to a maximum of 10, and > > shifts in 10s... so the page should look like: > > > > First | Previous | 1 2 3 4 5 6 7 8 9 10 | Next | Last > > First | Previous | 11 12 13 14 15 16 17 18 19 20 | Next | Last > > First | Previous | 21 22 23 24 25 26 27 28 29 30 | Next | Last > > > > and I can do this with scriptlets: > > ------------------------------------------------------- > > <% > > int SIZE = 2; > > int pageCount = ((Integer) > > session.getAttribute("pageCount")).intValue(); > > int mypage = ((Integer) > > session.getAttribute("page")).intValue(); > > > > int start = ( (mypage-1) / SIZE) * SIZE + 1; > > int end = ( (mypage-1) / SIZE) * SIZE + SIZE; > > if (end > pageCount) { end = pageCount; } > > for (int i = start; i <=end; i++) { > > %> > > <a href="main.jsp?page=<%=i%>"> > > > > <% if(i==mypage) { %> > > <font id="bigblack"> > > <% } else { %> > > <font id="smallblack"> > > <% } %> > > > > <%=i%></font></a> | > > <% > > } > > %> > > ------------------------------------------------------- > > > > How do I achieve this with webwork tags?? > > > > Thank you, > > > > James > > > > > > ------------------------------------------------------- > > This SF.Net email sponsored by: Free pre-built ASP.NET sites > > including Data Reports, E-commerce, Portals, and Forums are > > available now. Download today and enter to win an XBOX or > > Visual Studio .NET. > > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet > _072303_01/01 > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet _072303_01/01 _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
