do you create the cookie yourself? If yes: you can set the lifetime using this code:
Cookie cookie = new Cookie ("name", "value");
//Set lifetime: here 60 sec * 60 minutes * 24 hours * 365 days = 1 year
cookie.setMaxAge( 60 * 60 * 24 * 365);
If the cookie is autocreated by some library, please provide more details.
Hope this helps
I am using the previous code to add cookie but when close IE and then open to try any thing base on cookie i found old cookie losted and default values loaded
Did you try it with a different browser (e.g. Firefox)?
I had never used Cookies in JBoss, but I think I would have heard about it being broken, so I assume it works ;-).
FF work but IE7 not work, i found this issue in Tomcat server when use version 1 cookie; set cookie path between double quotes and this make IE can not use generated cookies by tomcat
And to solve this issue use version 0 but this version has limitaion in some characters (:=;'"()) usage.
check these links.
All the Special charecter like (white space, brackets, parentheses, equals signs, commas, double quotes, slashes, question marks, at signs, colons and semicolons) can store in cookie value if we are adding space
2. instead of storing value like id:2|name:India if we store id:2|name:India<space> then it is going to stored in cookie value
here<space> mean while construting the cookie value using these charecter add/append space to it. and while retrieve the value from cookie remove the space by trim().