Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Applet CookieManager not adding cookie to browser

Nguyen Dang Luat
Posts: 1
  • Mark post as helpful
  • send pies
  • 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. 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) {

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

Many thanks!
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!