Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Usage of ${ }

 
Aniket Patil
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not yet clear about when a variable needs to be wrapped with ${ }. For instance, the c:forEach is as follows:

<c:forEach var = "someVar" items = "${collection}" />

Why does "collection" need to be wrapped with ${ }, why not just a items = "collection". How does a "${collection}" differ from "collection"? More importantly, when is the ${ } needed?
[ January 29, 2007: Message edited by: Aniket Patil ]
 
neetika sharma
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to me... something inside{} means evaluate the particular thing.Basically {} refers to evaluate... Taking your example...


Originally posted by Aniket Patil:
[QB]I'm not yet clear about when a variable needs to be wrapped with ${ }. For instance, the c:forEach is as follows:

<c:forEach var = "someVar" items = "${collection}" />

QB]


iteration will be done over the value of the collection, {collection} and then result of each iteration is stored in "somevar", so that you can acess a particular element of the bean(stored in somevar). kindly corect me , if i m wrong:-)
 
Sayak Banerjee
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CHECK THIS
 
Aniket Patil
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Enlightening...

BTW i read-up the description of <c:catch var> in JSTL, and it is as below:

From dynamic, i assume an EL Expression is not possible. The table mentions
Type as String but also says the type is of the exception thrown. What does the Type column mean?
 
Kevin DesLauriers
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do belileve that it means that it must be a String literal and not EL, scripting or an action.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!