• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

About Head First Chapter 8 mock exam

 
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In HF book, mock exam of chapter 8, question 1:


Given HTML form that uses checkboxes to allow a user to select multiple values fro a parameter called hobbies. Which EL return the first value of hobbies?

The answers are :
${param.hobbies}
${paramValues.hobbies[0]}



Option D: ${paramValues[hobbies][0]}
Why this does not work?
According to p.379 example musicMap["Ambient"] is the same as musicMap.Ambient.
paramValues is a map and hobbies is the key. This hobbies key contains a string array.
So, based on this theory, option D should work.
 
Himai Minh
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I know why.
Let me try ${paramValues["hobbies"][0]} to see if that works.
 
Himai Minh
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To answer my own question, this is my JSP:


The answer is Yes. ${paramValues["hobbies"][0]} and ${paramValues.hobbies[0]"}
return the same values.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic