就用session.invalidate()的方法来注销,也可以把相应的JavaBean的值设置成null
比如:
bean.setUsername(null);

解决方案 »

  1.   

    在web.xml中我进行如下设置,系统就自动效验密码:
        <security-constraint>
            <web-resource-collection>
                <web-resource-name>index</web-resource-name>
                <url-pattern>/index.jsp</url-pattern>
            </web-resource-collection>
            <auth-constraint>
                <role-name>1sadu</role-name>
            </auth-constraint>
        </security-constraint>
    利用invalidate方法我是这样清楚得,不知道对不对:
    protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
            HttpSession s = req.getSession();
            s.invalidate();
            res.sendRedirect("one.html");
        }