我有两个问题:
答案 0 :(得分:2)
不确定java EE登录应用程序。但我想你想阅读Session Cookies。
答案 1 :(得分:1)
您需要从战争模块中保存Cookie。
保存cookie。
FacesContext facesContext = FacesContext.getCurrentInstance();
Cookie cookie = new Cookie("Your Cookie", "Some one");
cookie.setMaxAge(expiry);
HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
response.addCookie(cookie);
从Cookie加载
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
for (Cookie cookie : request.getCookies()) {
if (cookie.getName().equals("Your Cookie")) {
// if cookie equals then
externalContext.redirect("some page");
}
}