Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL & Cookies

 
Mark Beavis
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there -

I'm trying to write some JSTL to print out all the cookies in the current request.

Here is my code:


and I get an exception:
Unable to find a value for "name" in object of class "java.util.HashMap$Entry" using operator "."


I also tried the [] operator and nothing at all was printed.

Can anyone help.

Thanks
Mark
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
${cookie} is a Map whose key is the cookie name, and whose value is the Cookie itself.
Iterating through a Map returns Map.Entry elements, so in your example, currentCookie is a Map.Entry.



1. currentCookie.key calls getKey() on Map.Entry
2. currentCookie.value calls getValue() on Map.Entry. It returns a Cookie.
3. currentCookie.value.value calles getValue() on Cookie. It returns a String.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic