| Author |
Difference between [c:forEach] and [logic:iterate]
|
Nicholas Cheung
Ranch Hand
Joined: Nov 07, 2003
Posts: 4982
|
|
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
|
SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11945
|
|
|
The JSTL c:forEach tag is standard and is often recommended over Struts' logic:iterate.
|
Author of Test Driven (Manning Publications, 2007) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
somkiat puisungnoen
Ranch Hand
Joined: Jul 04, 2003
Posts: 1312
|
|
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
|
SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
|
 |
Nicholas Cheung
Ranch Hand
Joined: Nov 07, 2003
Posts: 4982
|
|
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
Sheriff
Joined: Jan 23, 2002
Posts: 11945
|
|
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.
|
 |
Surasak Leenapongpanit
Ranch Hand
Joined: May 10, 2002
Posts: 341
|
|
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
Sheriff
Joined: Jan 23, 2002
Posts: 11945
|
|
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...).
|
 |
 |
|
|
subject: Difference between [c:forEach] and [logic:iterate]
|
|
|