I have figured out how to have my action class be called whenever user click
on a page index(solution is to have url="/rootcontext/paymentHistory.do").
So the first question I asked below is solved.

Now I encountered another problem. When user click on the 10th page(Please
see the following senario for detail), the first 500 records will be removed
from session, and the next 500 records will be retrieved from DB, and
displayed to user. From logic view of point, the second 500 records should
be displayed from page 11-20. But now, the page number still shows 1-10, and
only the last records on 10th page is from second 500 records(the last
record). The rest of the records dispalyed are still from the first 500
records. This is not correct.

My question: How can I have the page index to be displayed correctly, and
works correctly?

Thank you very much for your help.

Jenny


----- Original Message -----
From: "Jenny" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, September 22, 2002 6:59 PM
Subject: urgent!!!---Re: does struts has the functionality?


I have a question about using jspTags
pager(http://jsptags.com/tags/navigation/pager/
).

Anand, I am sorry to send this email to you directly. I know you are expert
on using jspTags pager. I urgently need your help. I hope you can recieve my
email, and help me!

If someone has used the jspTags pager before, please help me!! I am stunk
here.

Senario:
There are lot of payments history records for a user. I will retrieve 500
records from DB at one time, and put them into session. When the next 500
records are retrieved, they will replace the first 500 records in the
session. For example, if a user have 1200 records totally, at first time,
the first 500 records will be retrieve from DB. To display the records, I
use jspTags pager (http://jsptags.com/tags/navigation/pager/). On one page,
50 records will be displayed. So the first 500 records will be displayed on
10 pages. When user click on the last page(10th page), I want the next
500(501-1000) records to be retrieved, replace the first 500 records in the
session, and then to be displayed to user. To achieve this, in my action
class, I need to keep track the page number that the user click on.When the
action class find that the last page(10th page) is clicked, The next 500
records will be retrieved, and be displayed to user.

My Jsp name: paymentHistory.jsp

My status and problem:
The first 500 records can be displayed on 10 pages correctly. When I click
on the page index(for example, I click on page "2"), the URL changed to
http://..../rootcontext/paymentHistory.jsp?pager.offset=50. BUT MY ACTION
CLASS IS NEVER BE CALLED.I AM STUNK HERE!!!

My question:
1. How can I make the my action class to be called whenever user click on a
page index?( I tried put <html:form action="paymentHistory.do"> in my
paymentHistory.jsp. but it shows same result. So I guess when user click on
page index, it does not submit the form).
2. How can I pass "pageNumber" as a request parameter? (I tried put
<pg:param name="pageNumber" /> inside <pg:pager>. It doesn't show pageNumber
on URL. I also tried to put "?number=<%= pageNumber %>" in the line <a
href="<%= pageUrl %>?number=<%= pageNumber %>"><%= pageNumber %></a>. It
doesn't work.

The following is my paymentHistory.jsp:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java"
 import="org.apache.struts.webapp.example.Payment" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<!-- for page navigation-->
<%@ taglib uri="http://jsptags.com/tags/navigation/pager"; prefix="pg" %>

<html:html locale="true">

<head>
 <title>history</title>
 <META name="GENERATOR" content="IBM WebSphere Studio">
</head>
<body>
  <table align="center" cellspacing="0" cellpadding="0" border="0"
width="480">
  <tr>
    <td align="center">Payment History</td>
  </tr>
   </table>
  <hr>
  <!--This following table is used to display account history-->
  <table align="center" cellspacing="0" cellpadding="0" border="0" >

  <!-- payment history header -->
  <logic:present name="payments">
  <tr>
    <td>
      Amount
    </td>
    <td>
      Balance
    </td>
  </tr>
<html:form action="/paymentHistory.do">
<pg:pager maxPageItems="1">

  <logic:iterate id="aPayment" name="payments" scope="session" >
  <tr>
  <pg:item>
  <td>
  <bean:write name="aPayment" property="amount"/>
  </td>
<td>
 <bean:write name="aPayment" property="balance"/>
  </td>
  </pg:item>
  </tr>
  </logic:iterate>
   </table>
   <!-- page navigation area -->
    <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>
</html:form>
  </logic:present>

</body>
</html:html>

Thanks for your help.











> > > -----Original Message-----
> > > From: Jenny [mailto:[EMAIL PROTECTED]]
> > > Sent: Saturday, September 14, 2002 12:14 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: does struts has the functionality
> > >    ----- Original Message -----
> > > From: "Anand Belaguly" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Saturday, September 14, 2002 1:58 PM
> > > Subject: RE: does struts has the functionality
> > >
> > >
> > > > Jenny,
> > > >
> > > > Thanks for the link, it looks good.I will try it sometime.
> > > > We have used the jspTags pager for recordsets more
> > > > than 2500 records(one time query) and it gets displayed in less
> > > > than 2 seconds.Also it is very easy to use, you just
> > > > need to encapsulate ur presentation logic with these tags.
> > > >
> > > > Anand
>
> > > > ----- Original Message -----
> > > > From: "Anand Belaguly" <[EMAIL PROTECTED]>
> > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > > Sent: Friday, September 13, 2002 4:42 PM
> > > > Subject: RE: does struts has the functionality
> > > >
> > > >
> > > > > This works pretty good.
> > > > >
> > > > > http://jsptags.com/tags/navigation/pager/
> > > > >
> > > > > Anand
> > > > >
> > > > > -----Original Message-----
> > > > > From: jenny zhang [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Friday, September 13, 2002 1:32 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: does struts has the functionality
> > > > >
> > > > >
> > > > > Hi, there:
> > > > >
> > > > > Does struts has the functionality of supporting page
> > > > > navigation? I have over 100 search results, I would
> > > > > like display them inseperate pages(10 records/page).
> > > > > In each page, I would like have previous, next button.
> > > > > I am not sure if struts has the functionality. If you
> > > > > know this, could you please share the info? I
> > > > > appreciate your info.
> > > > >
> > > > > Thanks
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> ______________________________________________________________________
> > > > > Post your free ad now! http://personals.yahoo.ca
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > > > For additional commands, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > > >
______________________________________________________________________
> > > > Post your ad for free now! http://personals.yahoo.ca
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > > ______________________________________________________________________
> > > Post your ad for free now! http://personals.yahoo.ca
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> > ______________________________________________________________________
> > Post your ad for free now! http://personals.yahoo.ca
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> ______________________________________________________________________
> Post your ad for free now! http://personals.yahoo.ca
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


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

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

Reply via email to