代码就不贴了 就是有个注销按钮 点了之后触发Action 那个action里面内容很简单就是
session.removeAttribute("aa");这样之后跳转回登入界面照理这样就注销好了 可是我在浏览器地址栏打上登入的地址 还是能进入管理页面 ,此时并没有登入 这样并没有真正实现注销 求回答算了我贴两句。。struts.xml:   <action name="emplogout" method="logout" class="logoutaction">
    <result name="success">index.jsp</result>
   </action>action:
public String logout()  throws Exception{


session.removeAttribute("employee");
return "success";


}bean:
<bean name="logoutaction" class="com.infosystem.employeemanagement.action.EmployeemanagementAction">
        <property name="ied" ref="IEmployeemanagementDAO"></property>
     </bean>整合过Spring的
    

解决方案 »

  1.   

    我们项目是在过滤器实现权限和登录判断的,每个用户都有多个角色,每个角色能访问指定的路径。客户端所有的请求都会在过滤器里判断,如果session为空直接跳去登录,不为空着判断这个角色有没有访问该页面的权限。。
      

  2.   

    过滤器我有配
    public class EmployeeFilter implements Filter { public EmployeeFilter() {
    // TODO Auto-generated constructor stub
    } public void destroy() {
    // TODO Auto-generated method stub } public void doFilter(ServletRequest arg0, ServletResponse arg1,
    FilterChain arg2) throws IOException, ServletException {
    // TODO Auto-generated method stub

    HttpServletRequest request = (HttpServletRequest) arg0;
    HttpServletResponse response = (HttpServletResponse) arg1;
    String url = request.getRequestURI();
    if("/infosystem/index.jsp".equals(url)||"/infosystem/login".equals(url)||url.endsWith(".gif")||url.endsWith(".js")||url.endsWith(".css")){
      
    arg2.doFilter(request, response);
    return ;

    }

    HttpSession session = request.getSession();



    if(session.getAttribute("employee")!=null){
    arg2.doFilter(request, response);
    }
    else{
    response.sendRedirect("index.jsp");
    }
    }我的问题就是可以通过地址栏来绕过验证,注销并没有效果,是因为浏览器的缓存吗?
      

  3.   


    嗯嗯 这样了解
    我去试了下别的网站 别人网站登入就直接从地址上保护 不会出现action名字的 怪不得没我这样的问题
      

  4.   

    输入url后         判断当前userID这个session是否存在   如果不存在直接跳转到登录界面   
    session.removeAttribute("aa");是会执行移除操作的
      

  5.   

    注销要用session.invalidate();
    不是session.removeAttribute("zhi");
    区别:获取的session是个map集合,而这个集合通过代理器递交给request.session的,删除session中的值而request.session还存在30分钟,框架默认值。
      所以得用session.invalidate();使整个会话死亡,不然就会出现,在你在单点登录的时候,你注销了当前用户后,这个用户将会在30分钟内无法登陆!!!!