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

Java Applet CookieManager not adding cookie to browser

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my application, we use java applet to write cookie on browser and use jquery to read this cookie. I tried do like tutorial but I always don't see the cookie set on my browser.

http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/accessingCookies.html And here is my code: The first I create a class to handle the cookie



Then I call it in main applet (I use jquery to run this applet):

try {
cookie = new CookieAccessor();
HttpCookie cookiedata = new HttpCookie("UserName", "Jonh");
URL url = new URL(getCodeBase().toString());
cookie.add(url.toURI(), cookiedata);
} catch(Exception e) {
e.printStackTrace();
}

But I've checked the browser cookies and there's no UserName What is missing in this code?

Many thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic