File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting Cookie

 
Jigar Naik
Ranch Hand
Posts: 761
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a small application to create and set cookie. My servlet code is bellow.



can anybody tell me what will this code do ?
and if it is creating cookie than where can i see my cookie ?
what will be the default location of my cookie ?
how cn i set the cookie location ?
I want to set the cookie at client end.
 
Shu Gao
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code creates a cookie named 'param1', and map its value to whatever the value of the query parameter 'param1' is, and its expiry value is 1800 seconds.

developers don't need to worry about the location, the cookie is by default stored on client-end, where the location is where your browser store your temporary internet files.

Hope that helps.
 
Jigar Naik
Ranch Hand
Posts: 761
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but how do i retrive the name value pairs stored in the cookie ?
 
Jigar Naik
Ranch Hand
Posts: 761
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and what does this function doing



I had written it to know the location of cookie at client end.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jigar Naik:
and what does this function doing



Java Doc would be your first place to know about it..Cookie.getPath
[ January 08, 2007: Message edited by: Saif uddin ]
 
santhoshkumar samala
Ranch Hand
Posts: 156
Eclipse IDE Hibernate Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can get name value pairs by using following code



loop through cookies array using a for or while loop

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic