in login.jsp, use the following code to get the Cookie
<%
String name= "";
String passward= "";
Cookie[] Cookies=request.getcookies ();
if (cookies!=null) {
for (int i=0;i<cookies.length;i++) {
Cookie cookie = cookies[i];
if (Cookie.getname (). Equalsignorecase ("OA")) {
String Value=cookie.getvalue ();
if (Value.indexof ("-")!=-1 && value.split ("-"). Length>1) {
Name=cookie.getvalue (). Split ("-") [0];
Passward=cookie.getvalue (). Split ("-") [1];
}
}
}
}
%>
Save cookies in the Java file with the following code
String savecookie= request.getparameter ("Savecookie");
String username = request.getparameter ("name");
String Password = request.getparameter ("Passward");
If ("". Equals (Savecookie)) {
cookie cookie = new Cookie ("OA", null);
cookie.setmaxage (0);
Cookie.setpath ("/");
Response.addcookie (cookie);
} else if (Savecookie.equals ("save") {
cookie cookie = new Cookie ("OA", username + "-" + Pass Word);
Cookie.setmaxage (24 * 60 * 60 * 365);//No time set, unable to save local cookie
Cookie.setpath ("/");
Response.addcookie (cookie);
}