This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

The function containsKey must be used with a prefix when a default namespace is not specified  RSS feed

 
Stan Lederer
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some jsp code that works fine. I am wanting to modify that code to conditionally display some HTML if a particular cookie is not set.

On this page (http://stackoverflow.com/questions/7395176/check-if-cookie-exists-with-jsp-el) I see that I should be able to do this:



But, I get this exception:

The function containsKey must be used with a prefix when a default namespace is not specified

I don't understand the message and would appreciate help. Thanks.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of JSP? You can't just call any old method in all but the very latest.
 
Stan Lederer
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat version is 6.0.32 and, according to this page (http://wiki.apache.org/tomcat/TomcatVersions), the jsp version is 2.1.

What's the recommended way to read a cookie in JSP 2.1? Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's likely something I'd test in the page controller and set a scoped variable to control page flow.
 
Stan Lederer
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's likely something I'd test in the page controller and set a scoped variable to control page flow.

I don't follow you. I'm thinking that I should just test the cookie in the servlet using getCookies() and pass something useful (e.g. true or false) to the jsp via the request object. Are you saying something different? If so, please elaborate. Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, that's exactly what I said. (Using correct terminology )
 
Stan Lederer
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great. Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!