I know its not that elegant, but generate an array of page numbers in your
ActionForm based on the count

private int pageCount;

public String[] getPages() {

  String[] pages = new String[pageCount];

  for (int i = 0; i < pageCount; i++) {
    int j = i + 1;
    pages[i] = ""+j;
  }

  return pages;

}

Alternatively, write your own Tag which will look up a specified value in
your bean and loop the appropriate number of times.

Niall

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 27 April 2001 20:29
> To: [EMAIL PROTECTED]
> Subject: Iterate certain number of times?
>
>
>
>
> Hi.
>
> Am wanting to iterate a certain number of times, based on a value
> in my form
> bean, to create a set of page links for the number of pages the
> user can view
> (similar to at the bottom of most search engine results).
>
> How do I do this with Struts?  Obviously I am not iterating over
> a collection.
> But surely it is possible - what am I missing?
>
> Many thanks,
>
> Dave
>
>
>
>

Reply via email to