cookies[loop].setMaxAge(0);
hres.addCookie(cookies[loop]);
}
}
}
}
//
透过EJB从数据库读取资料进行比对
//validate against the registered users
SignOnLocal signOn = getSignOnEjb();
//请加入侦察程序代码,方便稍候程序验证
System.out.println("进行EJB tier使用者验证");
//帐号及密码验证
boolean authenticated = signOn.authenticate(userName, password);
if (authenticated) {
//验证成功则将使用者帐号(USER_NAME)及是否已登入(SIGNED_ON_USER)参数
存入Session
// place a true boolean in the session
if (hreq.getSession().getAttribute(USER_NAME) != null) {
hreq.getSession().removeAttribute(USER_NAME);
}
hreq.getSession().setAttribute(USER_NAME, userName);
// remove the sign on user key before putting it back in
if (hreq.getSession().getAttribute(SIGNED_ON_USER) != null) {
hreq.getSession().removeAttribute(SIGNED_ON_USER);
}
hreq.getSession().setAttribute(SIGNED_ON_USER, new Boolean(true));
//将网页转导就会到达我们的目的地-使用者基本资料浏览画面(customer.do)
// redirect to the original destination
String targetURL =
(String)hreq.getSession().getAttribute(ORIGINAL_URL);
hres.sendRedirect(targetURL);
return;
} else {