• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there some easier way to set and retrieve cookies?  RSS feed

 
Fabio Fonseca
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all!

Is there any way to set cookies using scriptlets (nor custom tags) in JSP 2.0? Only using JSP and/or JSTL?

I got the cookies all alright, but I want to know if there is some easier way.

Please take a look on what I did:

to set:



Everything is running fine, but there *must* be some easier way!
[ July 17, 2006: Message edited by: Fabio Fonseca ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What could be easier?

If you're only looking to evaluate a expression based upon cookie existance:

${empty cookie.whatever ? 'no' : 'yes' }
 
Fabio Fonseca
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, Bear!

Seems like the other part of the code is gone:



I had no problem in reading the cookie, but in setting it. I had to use the scriptlet above in order to set it.

Is it possible to use JSTL and/or EL to get the same result?

But it is nice to see that I can use ternary operators in JSP. didn't know about that!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!