Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

check for cookie using tags  RSS feed

 
Rashid Darvesh
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...
 
Dan Novik
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
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 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.
 
vijayakumar vivekanandan
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!