• 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

Difference between [c:forEach] and [logic:iterate]

 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have seen some posts that discussed about <logic:iterate> tag. Seems to me that, this tag is going to loop through a list or collection and access it one by one. I have not used it before, but it seems provide similar functions as <c:forEach>.

Could anyone tell me the major difference between the <c:forEach> tag and <logic:iterate> tag?

Nick
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JSTL c:forEach tag is standard and is often recommended over Struts' logic:iterate.
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note: - Many of the features in this taglib are also available in the JavaServer Pages Standard Tag Library (JSTL). The Struts team encourages the use of the standard tags over the Struts specific tags when possible.

The "struts-logic" tag library contains tags that are useful in managing conditional generation of output text, looping over object collections for repetitive generation of output text, and application flow management
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lasse,

If it is recommended to use JSTL core library, why I saw some many people try using Struts' <logic> tag, instead of <c> tag?

That's really interesting.

And that's why I wanna know, is that becos something that <logic> can do, but <c> cant, so, people try to use <logic>.

Nick
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nicholas Cheung:
If it is recommended to use JSTL core library, why I saw some many people try using Struts' <logic> tag, instead of <c> tag?


Perhaps because the vast majority of application servers in production today don't have JSTL support, yet.
 
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lasse,


Perhaps because the vast majority of application servers in production today don't have JSTL support, yet.



You can support JSTL as well as Struts tag-lib.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by surasak lee:
You can support JSTL as well as Struts tag-lib.


Yes, if you're using a recent-enough application server or if you download and "install" a JSTL implementation. What I meant was that JSTL taglibs are not available out-of-the-box on most application servers in production today (for example, Tomcat 4.1 represents a big share of what's out there and plain vanilla Tomcat 4.1 does not include the JSTL taglibs...).
 
reply
    Bookmark Topic Watch Topic
  • New Topic