About Question enthuware.jwpv6.2.1020 :
Moderator: admin
About Question enthuware.jwpv6.2.1020 :
Why is this correct ?
${map[map["2"]]}
Isn't this a map of a map ?
${map[map["2"]]}
Isn't this a map of a map ?
Re: About Question enthuware.jwpv6.2.1020 :
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 :
When do you have to put quotes around the contents of [] in el?
whats the difference between ${map[map[2]]} and ${map[map["2"]]}?
whats the difference between ${map[map[2]]} and ${map[map["2"]]}?
Re: About Question enthuware.jwpv6.2.1020 :
Yeah..
whats the difference between ${map[map[2]]} and ${map[map["2"]]}?
Anybody to help>..
whats the difference between ${map[map[2]]} and ${map[map["2"]]}?
Anybody to help>..
-
- Site Admin
- Posts: 10066
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1020 :
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).
If you like our products and services, please help us by posting your review here.
-
- Posts: 12
- Joined: Fri Aug 15, 2014 10:16 am
- Contact:
Re: About Question enthuware.jwpv6.2.1020 :
Could someone explain me, why option 3 is wrong?
when considering question on 'enthuware.jwpv6.2.1019' it also should be a correct answer.
when considering question on 'enthuware.jwpv6.2.1019' it also should be a correct answer.
-
- Site Admin
- Posts: 10066
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1020 :
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.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 20
- Joined: Thu Dec 19, 2013 8:22 am
- Contact:
Re: About Question enthuware.jwpv6.2.1020 :
sorry but am not convinced can you put it in simpler words thanksadmin 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).
any reference example on internet would be good thanks
and why the question has no explanation ! it is categorized as tought right!
-
- Site Admin
- Posts: 10066
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1020 :
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.
For examples, you can try writing short jsp programs and run it under tomcat.
-Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 153 guests