Results 1 to 2 of 2

Thread: Remove cookie

  1. #1
    erakhman is offline Member
    Join Date
    May 2010
    Rep Power

    Default Remove cookie

    when i remove a cookie, cookie in firefox has remove but in my code has'nt remove. this is my code, please help me...

    Java Code:
    	public Cookie getMyCookie() {
    		if (context.getRequest().getCookies() != null) {
    			Cookie[] cookies = context.getRequest().getCookies();
    			for (int i=0; i<cookies.length; i++) {
    				if (cookies[i].getName().equals("myCookie")) {
    					myCookie = cookies[i];
    		return myCookie;
    Java Code:
    if (getMyCookie() != null) {
    thanks for your help.

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Rep Power


    What's your problem again?

    That code you posted, the first method sets myCookie, but there's nothing in there to say what myCookie is should there be no Cookies in the request. Where is myCookie declared?

Similar Threads

  1. Setting domain of cookie
    By mintyzzz in forum Java Servlet
    Replies: 1
    Last Post: 10-23-2010, 04:29 AM
  2. Cookie value is appending with some other unknown characters
    By soujanya in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-26-2010, 12:11 PM
  3. Browser Cookie Access
    By OrangeDog in forum Java Applets
    Replies: 1
    Last Post: 04-28-2009, 04:44 AM
  4. Setting cookie from doPost
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-25-2008, 08:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts