actually i am working on java ee6 web application i tried to set value and max age for the cookie...but i was uanble to set maxage what ever the max age value i give .it shows as -1.but my browser accepts and stores cookie.<br><br>
Cookie sa=new Cookie("ssample", "welcome");
A maxage of -1 indicates that its a browser cookie i.e. the cookie lasts as long as the browser which is usually the preferred approach for sessions. You have a bug somewhere in your code or the application server has some settings which kicks in when the response is sent.