Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old August 6th, 2001, 01:59 AM
Slak Slak is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 21 Slak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Slak
java/cookies

I am looking for some way to set up a code that will install a cookie on a user's system that will store any and all information they have entered in a form, so that next time they come to the page the fields will already have their information entered.

I have looked all over for any kind of documentation on cookies, and I can only find things on tracking users and such. I know it is possible because the Ikonboard on my site does it, I've tried sifting through the code to figure it out, but it is all too far over my head.

I found a javascript here in the "Clip Scripts" that appears to do what I want it to, but for some reason when I click on the link I just get a page full of code rather than the html page. I tried sifting through all the jumbled code to make sense of the java, but I can't get it to work. Plus, the script was copyrighted in 1996, and only talks about Netscape (barf).

Any help in the right direction would be greatly appreciated. Just any help on cookies in general...

Reply With Quote
  #2  
Old August 15th, 2001, 06:22 PM
wolfespawn wolfespawn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 68 wolfespawn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via AIM to wolfespawn
cookies

not sure if this is what you want.....

these are the methods or whatever you put in your servlet (at least this is what i use)
---------

public boolean putCookie(HttpServletRequest req, HttpServletResponse resp
, String name, String value
) {
Cookie c = new Cookie(name, value);
c.setMaxAge(put an integer in here for second or a zero for it to die when browser is closed);
resp.addCookie(c);
return true;
}

public String getCookie(HttpServletRequest req, HttpServletResponse resp
, String name
) {
Cookie[] cookies = req.getCookies();
String ret = null;
for (int i = 0; i < cookies.length; i ++) {
if (cookies[i].getName().equals(name)) {
ret = cookies[i].getValue();
break;
}
}
return ret;
}




these lines are examples of how i get and put cookies....
--------------

String login = getCookie(req, resp, "login");
String password = getCookie(req, resp, "password");

putCookie(req, resp, "login", user);
putCookie(req, resp, "password", pass);

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > java/cookies


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway