Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Differences between <logic:iterate> and <c:forEach>  RSS feed

 
ranvijay kumar
Greenhorn
Posts: 5
Java jQuery MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the Differences between <logic:iterate> and <c:forEach>?
what is the best option to use???
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The former is proprietary to Struts, the latter is standard.
 
Stefan Evans
Bartender
Posts: 1836
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best option is the <c:forEach> tag.
Struts retro-fitted its tag libraries to incorporate and complement the JSTL.
They discarded a bunch of their tags which were superseded (eg most of the "logic" tag library) and modified other tags to work with JSTL tags.
So for instance a struts indexed property (which relies on a parent iterator tag to work out its current index) works equally well nested in a <logic:iterate> or a <c:forEach>

Bottom line: use the JSTL option where you can.
Things like forms, controls etc on the form, you still use the struts tags for, as JSTL doesn't deal with that side of things.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!