Erik,

The smart way to do this is abstract the business logic from that particular
page.

For example, create a 'Pager' object that stores the start and max items per
page.

Then you can have pager.getNextStart(), pager.getLastStart(),
pager.getEnd(), pager.getMax() etc.

Your action only needs one method - getPager()

Your view can then just have <a
href="MyAction.action?pager/start=<ww:property value="pager/nextStart" />">

This pager can then be used to page through ANY objects!

You can even implement a pager.getCurrentPage(List of object) which returns
a list containing only the current page of objects (given that the pager
knows the start and max).

Hope this helps - it's a very useful pattern.

-mike

On 14/11/02 1:53 AM, "Erik Beeson" ([EMAIL PROTECTED]) penned the
words:

> I return a very, very long list and would like to be able to page through
> it. I have a startIndex and count. The link to the next page should be
> startIndex=(startIndex+count); Since the business end was getting the list
> in the first place, this indexing stuff seemed like it belonged on the
> view end, but I guess I'll add a nextIndex and previousIndex fields or
> something.
> 
> --Erik
> 
> On Wed, 13 Nov 2002, Maurice Parker wrote:
> 
>> 
>> Erik Beeson wrote:
>> 
>>> I have and action that has two getters that return ints. Is there a way
>>> for my view to render the sum of them? Currently I use a bean that has a
>>> method int sum(int x, int y) { return x+y; }. Is there a better way?
>>> 
>>> 
>> Nope.  You're doing it the right way.  I'm not sure what you're adding,
>> but probably the sum has some kind of business meaning and this business
>> logic should be in the model.
>> 
>> As a general rule of thumb, if you are having trouble trying to get the
>> expression language to do something, it may be a sign that you are
>> embedding business logic, rather than presentation logic, in your JSP.
>>  The WebWork EL is is fairly powerful, but I almost never use any of
>> it's more advanced functionality.
>> 
>> -Maurice
>> 
>> 
>> 
>> 
>> -------------------------------------------------------
>> This sf.net email is sponsored by: Are you worried about
>> your web server security? Click here for a FREE Thawte
>> Apache SSL Guide and answer your Apache SSL security
>> needs: http://www.gothawte.com/rd523.html
>> _______________________________________________
>> Opensymphony-webwork mailing list
>> [EMAIL PROTECTED]
>> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
>> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by: Are you worried about
> your web server security? Click here for a FREE Thawte
> Apache SSL Guide and answer your Apache SSL security
> needs: http://www.gothawte.com/rd523.html
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork



-------------------------------------------------------
This sf.net email is sponsored by: Are you worried about 
your web server security? Click here for a FREE Thawte 
Apache SSL Guide and answer your Apache SSL security 
needs: http://www.gothawte.com/rd523.html
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to