session相关有关问题

session相关问题ActionContext actionContext ActionContext.getContext()Map session actionContext

session相关问题

ActionContext actionContext = ActionContext.getContext();Map session = actionContext.getSession();

注意:actionContext.getSession()得到的session是一个map对象,这个map对象有clear()和remove ()两方法,很容易看出这两方法的差别。

HttpSession session =request.getSession();session.removeAttribute("username");

注意:request.getSession()返回的是一个HttpSession对象,当用户推出一个系统时,应该调用HttpSession对象的removeAttribute()方法,这样可以防止没有登录的用户访问网页和后退操作了