Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

check for cookie using tags

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
 
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic