Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ page 386-Not in errata

 
Renu Radhika
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HFSJ page 386,its mentioned that to get the values of a cookie named username using EL,we have to give ${cookie.userName.value}.Cant we get it using ${cookie.userName} like other objects?is the �.value� required?is it a mistake?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cookie is an implicit object whose type is Map. It contains Cookie objects.
${cookie.userName} will return a Cookie. If you want its value, you'll have to call Cookie#getValue. So ${cookie.userName.value} is the right way to do it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic