• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

check for cookie using tags

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a cleaner way to check the existence of a cookie instead of getting an array of cookie and iterating over one by one. I want check whether a cookie exist and i dont want my jsp to have a scriplet to check that.
The existence of a session object can be determined by using <logic:empty> tag. is there a way something lilke this to check for cookies.

Thanks...
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes. See Cookie taglib in Coldtags suite http://www.servletsuite.com/jsp.htm
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yikes!
Do you get the source with these?
I'm always cautious when I see stuff like this:


From our users: "I must say that your tag's are amasing,
simply stunning. It makes the job so much easyer!"


And there's plenty on that site.

If you're going to market something in English, have someone who knows English proof read it.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe you can do this with EL. ${Cookie.yourCookieName}. It will not return null if the cookie is not there.

Then you can use <c:if > tag to check if the resultant value is null. This means the cookie is not available.

<c:if test="${Cookie.yourCookieName = null}">

I am also a beginner to EL. Try implementing this.
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there a way to check the value of the cookie as well with an if tag using struts tags instead of JSTL
Thanks...
 
Dan Novik
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>Yikes!
>Do you get the source with these?
a bit out of topic, but we have ;-)

As per spelling: it is a quote. Has been published "as is".
As per tag: yes, this taglib does the job in the original question
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic