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 on Expression Language

 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Assume that hobbies is an parameter that takes multiple values and whether the following EL expression evaluateto the first value of hobbies.

Answer is ${param.hobbies}. Can anybody throw light on this?


With regards,
Padma priya N.G.
 
Prafulla N. Patil
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think that will print all the options
 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to know why ${param.hobbies} is selected?
With regards,
Padma priya N.G.
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Priya,

Answer is perfectly OK.. I don't see any ambiguity in it.
See there are two ways of retrieving values of request parameters.

First one is ${param.names}
Second one id ${paramValues.names[]} for retrieving values if parameter contains more than one value.

If you want to retrieve the first value, you can do any of these:
Either
use ${paramValues.names[0]}, this can give you any value depending upon index.
or
use ${param.names}, this is going to give you only one value. Now what that value is gonna be? Obviously the first value that is stored in that parameter.

Regards,
Khushhal
[ August 22, 2007: Message edited by: khushhal yadav ]
 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kushal,
Thanks for the explanation.
With regards,
Padma priya N.G.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic