The constructor of the cookie object is called to create a cookie. The constructor of a cookie object has two string arguments: The cookie name and the cookie value.
Neither the name nor the value can contain white space characters and the following characters: [] () < > =, "/? @ : ;
The error is in Response.addcookie (cookie);//cookie is a cookie instance.
In the Java EE doc, the cookies only support ASCII characters and cannot have commas, semicolons,
Blank. or start with $. The name cannot be changed after it is created. If you want to store Chinese, first use Urlecode encoding, in the deposit, remove the time, with decode decoding.
Encode the value before saving the cookie:
Urlencoder.encode (Cookievalue, "UTF-8");
Decoding when the cookie value is taken:
Urldecoder.decode (Localcookievalue, "UTF-8");
Create Cookie throws Exception: Java.lang.IllegalArgumentException:Control character in cookie value