这个是jsp的文件------------------------------------------------------------------------------------------------------------
密码:
Cookies:
不保存
一整天
一整月
一整年
下面这个是java的文件------------------------------------------------------------------------------------------------------
import java.io.*;
import java.net.URLEncoder;
import java.util.Calendar;
import java.util.Date;
import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet {
public LoginServlet() {
super();
}
public void destroy() {
super.destroy();
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
String cookietime=req.getParameter("cookietime");
int cookietimes=Integer.parseInt(cookietime.trim());
Cookie c=new Cookie("Name",URLEncoder.encode(req.getParameter("username"),"utf-8"));
c.setMaxAge(cookietimes*60*60*24);
c.setPath("/");
res.addCookie(c);
Cookie a=new Cookie("Password",req.getParameter("password"));
a.setMaxAge(cookietimes*68*60*24);
a.setPath("/");
res.addCookie(a);
Calendar calendar=null;
String message=null;
calendar=Calendar.getInstance();
Date trialTime=new Date();
calendar.setTime(trialTime);
int hour=calendar.get(Calendar.HOUR_OF_DAY);
if(hour |