• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Doubt in JSTL "c:forEach"

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the items attribute in <c:forEach> tag refer only to request scoped variables?
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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???
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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--
 
If I'd had more time, I would have written a shorter letter. -T.S. Eliot such a short, tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic