Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in JSTL "c:forEach"

 
vijayakumar vivekanandan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the items attribute in <c:forEach> tag refer only to request scoped variables?
 
Rodrigo W Bonatto
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Using EL in items attribute of <c:forEach> tag, you can refer variables in the four scopes (page, request, session and application).

Cheers,

Rodrigo
 
vijayakumar vivekanandan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi rodrigue,
But if the same attribute is available in the same name in more than one scope what will the "items" in the c:forEach refer???
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vijayakumar vivekanandan:
But if the same attribute is available in the same name in more than one scope what will the "items" in the c:forEach refer???

Your question is about EL, not JSTL. If ${anAttribute} appears in a JSTL or anywhere it will look at page, request, session and application scopes, in that order. If you're worried about it, just use one of the implicit objects (ie ${requestScope.anAttribute}).

--Dale--
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic