5、退出

 

**功能三:用户退出功能**
    
    1. 把用户信息从HttpSession中清除

 

/crm/WebContent/top.jsp

/crm/src/com/louis/web/action/UserAction.java

    
    /**
     * 登录功能
     * @return
     */
    public String login(){
        User existUser = userService.login(user);
        // 判断,登录名或者密码错误了
        if(existUser == null){
            return LOGIN;
        }else{
            ServletActionContext.getRequest().getSession().setAttribute("existUser", existUser);
            // 登录成功
            return "loginOK";
        }
    }

/crm/WebContent/top.jsp

/crm/src/com/louis/web/action/UserAction.java

/**
     * 退出功能
     * @return
     */
    public String exit(){
        ServletActionContext.getRequest().getSession().removeAttribute("existUser");
        return LOGIN;
    }

 

posted on 2017-10-21 20:30  Michael2397  阅读(131)  评论(0编辑  收藏  举报

导航