• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Using logic:iterate  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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 Ruby VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi Marc,
Thanks.
 
Trust God, but always tether your camel... to this tiny ad.
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!