Meaningless Drivel is fun!*
The moose likes JSP and the fly likes Setting Cookies in Java or JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Setting Cookies in Java or JavaScript" Watch "Setting Cookies in Java or JavaScript" New topic
Author

Setting Cookies in Java or JavaScript

Saulo Menezes
Greenhorn

Joined: Jan 15, 2003
Posts: 17
I am currently studying the subject 'Cookies' and up to now I am a bit confused.
My group and I are about to create a site that will use solely jsp pages. In it I am in charge of the cookies.
The teacher intructed us to use JavaScript for that but I found out that it can be done using varied scripts or programming languages. Would anyone be able to tell me which would be the best solution? I intend to keep the date on the client-side.
Thanks
Saulo
[ March 26, 2003: Message edited by: Saulo Menezes ]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
You can use Javascript to manipulate cookies on the client (browser) side. Javascript is the only client side scripting language with wide support. Note that Javascript has practically nothing to do with the Java language.
On the server side you have to use the Servlet and JSP APIs to manipulate cookies.
Bill
Geeta Ramasami
Ranch Hand

Joined: Mar 05, 2003
Posts: 72
Hi..
To be more explanatory, if u want to store and user information on the client side u go in for cookies.If u want to store any user information on the server side u go in for session objects.
With respect to cookies u can create it on the client side using javascript as well as on the server side using JSP or servlets.
As ur cookie is however going to be stored in the client machine its better to create in client side as creating it on the server side involves an extra overhead of sending that cookie with the response object
Cheers
Geeta
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting Cookies in Java or JavaScript
 
Similar Threads
Getting values from a form
Changing variables dynamically
Update time
URL-Rewriting, Bullet Proof way?
JSP and Javascript Cookies