RE: Iterate certain number of times?

2001-05-08 Thread Mac Ferguson

jakarta taglibs has a utility:for tag - http://jakarta.apache.org/taglibs

Mac Ferguson
Senior Developer,
Communicopia Inc.

-Original Message-
From: shunhui zhu [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 01, 2001 1:05 PM
To: [EMAIL PROTECTED]
Subject: RE: Iterate certain number of times?


Hi, I have a similar problem. I'd like to use the
iterate tag to present a list of objects in a tabular
form, but I'd like to specify how many per row. Is
there an easy way to do that using only the tags?

Thanks.

Shunhui
--- [EMAIL PROTECTED] wrote:


 Does anyone know if any of the other taglibs
 provides a for loop?

 Dave





 [EMAIL PROTECTED] on
 04/30/2001 01:27:07 PM

 Please respond to
 [EMAIL PROTECTED]

 To:
 [EMAIL PROTECTED]
 cc:(bcc: David Hay/Lex/Lexmark)
 Subject:  RE: Iterate certain number of times?





 Hey that's pretty cool.  I got it working in about
 10 minutes.  One question
 though.  I had to move my iterate bean from Request
 to Session scope.  Is there
 any way to keep it at the request level?

 Thanks,
 Donnie Hall



 |+--
 ||  kbasel@freemail.|
 ||  absa.co.za  |
 ||  |
 ||  04/27/2001 03:21|
 ||  PM  |
 ||  Please respond  |
 ||  to struts-user  |
 ||  |
 |+--


---
-|
   |
   |
   |   To: [EMAIL PROTECTED]
   |
   |   cc: (bcc: Donnie Hall/Enron
 Communications)  |
   |   Subject: RE: Iterate certain number of
 times?|


---
-|



 Hi,

 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

 Hope it helps,
 karl

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 27 April 2001 09: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















__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




RE: Iterate certain number of times?

2001-05-01 Thread dhay



Does anyone know if any of the other taglibs provides a for loop?

Dave





[EMAIL PROTECTED] on 04/30/2001 01:27:07 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  RE: Iterate certain number of times?





Hey that's pretty cool.  I got it working in about 10 minutes.  One question
though.  I had to move my iterate bean from Request to Session scope.  Is there
any way to keep it at the request level?

Thanks,
Donnie Hall



|+--
||  kbasel@freemail.|
||  absa.co.za  |
||  |
||  04/27/2001 03:21|
||  PM  |
||  Please respond  |
||  to struts-user  |
||  |
|+--
  |
  ||
  |   To: [EMAIL PROTECTED]   |
  |   cc: (bcc: Donnie Hall/Enron Communications)  |
  |   Subject: RE: Iterate certain number of times?|
  |



Hi,

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

Hope it helps,
karl

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 27 April 2001 09: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
















RE: Iterate certain number of times?

2001-05-01 Thread shunhui zhu

Hi, I have a similar problem. I'd like to use the
iterate tag to present a list of objects in a tabular
form, but I'd like to specify how many per row. Is
there an easy way to do that using only the tags?

Thanks.

Shunhui
--- [EMAIL PROTECTED] wrote:
 
 
 Does anyone know if any of the other taglibs
 provides a for loop?
 
 Dave
 
 
 
 
 
 [EMAIL PROTECTED] on
 04/30/2001 01:27:07 PM
 
 Please respond to
 [EMAIL PROTECTED]
 
 To:  
 [EMAIL PROTECTED]
 cc:(bcc: David Hay/Lex/Lexmark)
 Subject:  RE: Iterate certain number of times?
 
 
 
 
 
 Hey that's pretty cool.  I got it working in about
 10 minutes.  One question
 though.  I had to move my iterate bean from Request
 to Session scope.  Is there
 any way to keep it at the request level?
 
 Thanks,
 Donnie Hall
 
 
 
 |+--
 ||  kbasel@freemail.|
 ||  absa.co.za  |
 ||  |
 ||  04/27/2001 03:21|
 ||  PM  |
 ||  Please respond  |
 ||  to struts-user  |
 ||  |
 |+--
  

|
   | 
   |
   |   To: [EMAIL PROTECTED]
   |
   |   cc: (bcc: Donnie Hall/Enron
 Communications)  |
   |   Subject: RE: Iterate certain number of
 times?|
  

|
 
 
 
 Hi,
 
 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
 
 Hope it helps,
 karl
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 27 April 2001 09: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
 
 
 
 
 
 
 
 
 
 
 
 
 


__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



Re: Iterate certain number of times?

2001-04-30 Thread dhay



Levi,

Thanks for your thoughts.  However, I believe I am doing things correctly as
follows:  this page displays a formatted version of a logfile on the server.
This logfile can be up to 50 MB in size, and a filtering mechanism is provided
so the user can browse the whole file, or certain categories of log entries.
Obviously, with a file of this size, it is not feasible to load it all into
memory at one time, and use a pager tag to display it.  Instead, I do the
necessary filtering, and create a list of file pointers to the log entries the
use wishes to see (things are further complicated as the variably length log
entries have to be reversed to display in chronologically descending order,
instead of ascending).  When the user requests the next page, the next chunk of
log entries are retrieved from the file through the action and displayed.

Everything is working nicely, and I want to put the finishing touches on it to
simply display links to each page, rather than just next and previous.  In
my initial action I calculate how many pages I have etc. and simply want to do a
for loop to create the links.  As Niall pointed out, I could load these page
numbers into a Collection and then use the iterate tag, but this seems to be be
overkill.

Is there really not a Struts tag to do a for loop?!!!  If not, I belive that
it is a major lack.  Are there any plans to introduce one, maybe when the logic
tags are improved?

Thanks.  Any other ideas gratefully received!

Dave





Levi Cook [EMAIL PROTECTED] on 04/27/2001 05:38:22 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Re: Iterate certain number of times?



Of course I have no idea what your system actually looks like, but I would
question its retrieving data all the way up to the view layer and then not
displaying it.

If possible I would reconsider the design of the controllers responsible
for constructing the Collection you are interested in iterating over.

Consider the following method signatures in a hypothetical controller for
searching a product catalog:

public Collection findProducts(ProductInfo searchCriteria)
vs.
public Collection findProducts(int startIndex, int count, ProductInfo
searchCriteria)
vs.
public Iterator findProducts(int startIndex, int count, ProductInfo
searchCriteria)

I would expect the first to return a collection of every product in my
entire system. I believ this is probably what your system is doing and I
wouldn't consider it especially useful in a controller responsible for
supporting a view.

The second approach introduces a bit more flexibility by allowing the view
the decide how many products its interested in displaying.

The third approach is probably what I would prefer, I think it just
clarifies the intent of the method for view builders.. Might be a little
stronger form of encapsulation too.

Just my thoughts anyway, hope its useful,
Levi Cook

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 27, 2001 3:46 PM
Subject: RE: Iterate certain number of times?




 Thanks, but I don't need all that functionality.  I have already set up
the
 paging in my actions, but want to generate the links myself simply looping
 through.

 Is there not a way to loop through some HTML a set number of times in
struts
 (rather than over a collection)?!

 Dave




 Karl Basel [EMAIL PROTECTED] on
04/27/2001
 04:21:17 PM

 Please respond to [EMAIL PROTECTED]

 To:   [EMAIL PROTECTED]
 cc:(bcc: David Hay/Lex/Lexmark)
 Subject:  RE: Iterate certain number of times?



 Hi,

 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

 Hope it helps,
 karl

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 27 April 2001 09: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


















RE: Iterate certain number of times?

2001-04-30 Thread Donnie_Hall



Hey that's pretty cool.  I got it working in about 10 minutes.  One question
though.  I had to move my iterate bean from Request to Session scope.  Is there
any way to keep it at the request level?

Thanks,
Donnie Hall



|+--
||  kbasel@freemail.|
||  absa.co.za  |
||  |
||  04/27/2001 03:21|
||  PM  |
||  Please respond  |
||  to struts-user  |
||  |
|+--
  |
  ||
  |   To: [EMAIL PROTECTED]   |
  |   cc: (bcc: Donnie Hall/Enron Communications)  |
  |   Subject: RE: Iterate certain number of times?|
  |



Hi,

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

Hope it helps,
karl

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 27 April 2001 09: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










RE: Iterate certain number of times?

2001-04-27 Thread Karl Basel

Hi,

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

Hope it helps,
karl

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 27 April 2001 09: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






RE: Iterate certain number of times?

2001-04-27 Thread dhay



Thanks, but I don't need all that functionality.  I have already set up the
paging in my actions, but want to generate the links myself simply looping
through.

Is there not a way to loop through some HTML a set number of times in struts
(rather than over a collection)?!

Dave




Karl Basel [EMAIL PROTECTED] on 04/27/2001
04:21:17 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  RE: Iterate certain number of times?



Hi,

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

Hope it helps,
karl

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 27 April 2001 09: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












Re: Iterate certain number of times?

2001-04-27 Thread Levi Cook

Of course I have no idea what your system actually looks like, but I would
question its retrieving data all the way up to the view layer and then not
displaying it.

If possible I would reconsider the design of the controllers responsible
for constructing the Collection you are interested in iterating over.

Consider the following method signatures in a hypothetical controller for
searching a product catalog:

public Collection findProducts(ProductInfo searchCriteria)
vs.
public Collection findProducts(int startIndex, int count, ProductInfo
searchCriteria)
vs.
public Iterator findProducts(int startIndex, int count, ProductInfo
searchCriteria)

I would expect the first to return a collection of every product in my
entire system. I believ this is probably what your system is doing and I
wouldn't consider it especially useful in a controller responsible for
supporting a view.

The second approach introduces a bit more flexibility by allowing the view
the decide how many products its interested in displaying.

The third approach is probably what I would prefer, I think it just
clarifies the intent of the method for view builders.. Might be a little
stronger form of encapsulation too.

Just my thoughts anyway, hope its useful,
Levi Cook

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 27, 2001 3:46 PM
Subject: RE: Iterate certain number of times?




 Thanks, but I don't need all that functionality.  I have already set up
the
 paging in my actions, but want to generate the links myself simply looping
 through.

 Is there not a way to loop through some HTML a set number of times in
struts
 (rather than over a collection)?!

 Dave




 Karl Basel [EMAIL PROTECTED] on
04/27/2001
 04:21:17 PM

 Please respond to [EMAIL PROTECTED]

 To:   [EMAIL PROTECTED]
 cc:(bcc: David Hay/Lex/Lexmark)
 Subject:  RE: Iterate certain number of times?



 Hi,

 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

 Hope it helps,
 karl

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 27 April 2001 09: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












RE: Iterate certain number of times?

2001-04-27 Thread Scott Cressler

Or a related feature, to know how many times you've iterated?  I had need to
know when I was on my last iteration so I could not put in an HR.  I think
it could be done differently, but right now, I'm actually porting an
existing site to struts.  I broke down and just put some Java code in to
have a counter that I could check.

I do hope improving the logic tags is on the list somewhere.  They are
pretty restrictive if you don't want to extend them.

Scott

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Friday, April 27, 2001 1:46 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Iterate certain number of times?
 
 
 
 
 Thanks, but I don't need all that functionality.  I have 
 already set up the
 paging in my actions, but want to generate the links myself 
 simply looping
 through.
 
 Is there not a way to loop through some HTML a set number of 
 times in struts
 (rather than over a collection)?!
 
 Dave
 
 
 
 
 Karl Basel 
 [EMAIL PROTECTED] on 04/27/2001
 04:21:17 PM
 
 Please respond to [EMAIL PROTECTED]
 
 To:   [EMAIL PROTECTED]
 cc:(bcc: David Hay/Lex/Lexmark)
 Subject:  RE: Iterate certain number of times?
 
 
 
 Hi,
 
 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
 
 Hope it helps,
 karl
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 27 April 2001 09: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
 
 
 
 
 
 
 
 
 



RE: Iterate certain number of times?

2001-04-27 Thread Niall Pemberton

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








Re: Iterate certain number of times?

2001-04-27 Thread Vincent Moynihan

Dave
Try the pager taglib from jsptags.com
http://jsptags.com/tags/

Vince
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 27, 2001 8:28 PM
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