• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using logic:iterate

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
There are a list of reports and each of the reports have been emailed to
people. For example : report 1 might have been emailed to 3 people ;
report 2 might have been emailed to 2 people etc. So, in a jsp page, I
need to display the list of report names. Under each of the report
names, I need to display the string "recipient(x)" where x is the
number of people the report has been mailed to. So, under report 1, 3
strings should be displayed "recipient 1, recipient 2, recipient 3" ;
under report 2, two strings should be displayed "recipient 1, recipient
2 " etc.
How will I accomplish the above using logic:iterate?

I know to display the report names one below the other. I need to put the report names in a list(collection) and put it in session. I can then use

<logic:iterate name="reports" property="reportNames"> ..</logic:iterate>

Similarly, I need to display the recipients using logic:iterate tag. For
this, I can put the number of recipients in a list. The ith elment of
the list will correspond to the ith report. But how should I display in
the Jsp ? How can I pass i into logic:iterate corresponding to the
recipient number .How to handle the <logic:iterate> inside <logic:iterate> ?

Any help is appreciated.


Thank you, Suman.

[ December 24, 2005: Message edited by: Suman Seshadri ]

[ December 24, 2005: Message edited by: Suman Seshadri ]
[ December 24, 2005: Message edited by: Suman Seshadri ]
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I strongly recommend using c:forEach (JSTL) instead of logic:iterate. Not only is it easier to use, it allows you to reference the index (aka the count) of the current iteration.

This site explains how to use it.
 
Perindevi Peramur
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marc,
Thanks.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic