Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

HFS..pg.420

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the HFS book..the 7th question....Is the "C" option true??
If its true ...will it take the fifth key's value ..??
I don't understand..pls reply..
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I think it's true, that means foo has an entry which is String type, and the string value is "5",so it is OK.
 
Deepa Korecherla
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think its not true....but still can anyone tell...??
It will work if foo is of type List but not Map...can anyone reply??
 
Deepa Korecherla
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anybody reply..with some explanation??
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree ${foo["5"]} and $foo.[5] should be equivalent in List . Assume Map have a key which is of type String "5" then it may make a difference. but surely this is a confusing question . Better Author tell what was in there head.
 
author
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

Option C of question 7 is correct. If 'foo' is a Map, then the argument to the map is some object (here the string "5") that acts as the key into the map.

However, this syntax will also work for lists because EL will convert the string "5" into the integer 5 at runtime to find the index into the list.

Here is a small code example that demonstrates these two use cases.


What do you think the result would be?

Cheers,
Bryan
[ February 22, 2005: Message edited by: Bryan Basham ]
 
Ranjit Jana
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bryan,

This makes things clear.

I take this opportunity to compliment you for bringing out "HF servlets and JSP". No doubt your sleepless nights for bringing this book out have saved huge volume of midnight oil(at least for me).

:-)

Regards,
Ranajit Jana
 
    Bookmark Topic Watch Topic
  • New Topic