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

${param[name]} and ${param["name"]} ?

 
Deepak Chopra
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to print the value of name parameter..but if i use

${param["name"]} --> printing the value successfully.

${param[name]} --> printing nothing

Why is that so? As per my knowledge...i think container first look if there is any attribute "name", if no then pass the "name" as map key!

can any one help me to explain why my code is behaving different?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think container first look if there is any attribute "name", if no then pass the "name" as map key!

Where did you read that ?
 
Deepak Chopra
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read the same in HFSJ page 375,

this is apply when we write : ${param[name]}
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have the book. How is it written ? If the attribute is not found, it will not use "name" as the map key. That would not make sense, would it ?
 
Khadija Lokhandwala
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
When a attribute name is entered in [] brackets without quotes , it is evaluated as a map key,if its value is not there, it will print nothin on the output
 
Nilesh Shekokar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When we say ${param[name]}
the name attribute name must be available in scope.
like request.setAttribute("name", "name");

thanks,
Nilesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic