Page 1 of 1
About Question enthuware.jwpv6.2.1020 :
Posted: Mon Nov 21, 2011 6:00 am
by ETS User
Why is this correct ?
${map[map["2"]]}
Isn't this a map of a map ?
Re: About Question enthuware.jwpv6.2.1020 :
Posted: Wed Nov 30, 2011 10:23 am
by Guest
map["2"] returns "3" and this result is used as argument for the second map call. And this will return 4.
Re: About Question enthuware.jwpv6.2.1020 :
Posted: Mon Feb 20, 2012 8:05 am
by chibee1620
When do you have to put quotes around the contents of [] in el?
whats the difference between ${map[map[2]]} and ${map[map["2"]]}?
Re: About Question enthuware.jwpv6.2.1020 :
Posted: Sun Jul 29, 2012 11:16 am
by Vimal
Yeah..
whats the difference between ${map[map[2]]} and ${map[map["2"]]}?
Anybody to help>..
Re: About Question enthuware.jwpv6.2.1020 :
Posted: Fri Nov 09, 2012 10:29 am
by admin
Please go through Section 1.6 of Expression Language Specification 2.2, which explains this very clearly.
The EL follows ECMAScript in unifying the treatment of the . and [] operators.
expr-a.identifier-b is equivalent to expr-a["identifier-b"]; that is, the
identifier identifier-b is used to construct a literal whose value is the identifier,
and then the [] operator is used with that value.
Similarly, expr-a.identifier-b(params)is equivalent to expra["
identifier-b"](params).
Re: About Question enthuware.jwpv6.2.1020 :
Posted: Sat Aug 30, 2014 12:59 am
by dhanuddhara
Could someone explain me, why option 3 is wrong?
when considering question on 'enthuware.jwpv6.2.1019' it also should be a correct answer.
Re: About Question enthuware.jwpv6.2.1020 :
Posted: Sat Aug 30, 2014 10:30 am
by admin
3 is not a valid identifier. It is an integer and is interpreted as an index. That is why map.o is ok (as is the case in 2.1019) but map.3 is not.
HTH,
Paul.
Re: About Question enthuware.jwpv6.2.1020 :
Posted: Mon Dec 08, 2014 1:10 pm
by shareef.hiasat
admin wrote:Please go through Section 1.6 of Expression Language Specification 2.2, which explains this very clearly.
The EL follows ECMAScript in unifying the treatment of the . and [] operators.
expr-a.identifier-b is equivalent to expr-a["identifier-b"]; that is, the
identifier identifier-b is used to construct a literal whose value is the identifier,
and then the [] operator is used with that value.
Similarly, expr-a.identifier-b(params)is equivalent to expra["
identifier-b"](params).
sorry but am not convinced can you put it in simpler words thanks
any reference example on internet would be good thanks
and why the question has no explanation ! it is categorized as tought right!
Re: About Question enthuware.jwpv6.2.1020 :
Posted: Mon Dec 08, 2014 8:15 pm
by admin
Sure, can you tell me with which part exactly do you have trouble understanding?
For examples, you can try writing short jsp programs and run it under tomcat.
-Paul.