代码就不贴了 就是有个注销按钮 点了之后触发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的
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的
解决方案 »
- 关于RMI的问题?急!!!!!!!!!!!!
- DOM4J 问题,以下是XML文件 ,我在读取XML文件的时候,不能将两个配置都读取出来,不知道大家有没办法。。。
- 想请教jboss中的jms的安全与认证处理问题,有做过类似的吗?
- XFIRE 的动态调用
- struts2自动去除首尾空格
- 望JSF高手指点
- struts----真的把我搞馈了!!!(真心希望各位兄弟姐妹能够帮我一下!!!!谢了先!!!!!!!!!!!!!!!)
- ant中java任务中fork属性是什么意思呀?
- innodb和myisam的区别
- execute node failed. Execute node failed :failed to receive from server
- 调用js时,提示缺少对象
- 采用JAVA SSH框架编程的人,必须、绝对、应该知道的事情!!
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");
}
}我的问题就是可以通过地址栏来绕过验证,注销并没有效果,是因为浏览器的缓存吗?
嗯嗯 这样了解
我去试了下别的网站 别人网站登入就直接从地址上保护 不会出现action名字的 怪不得没我这样的问题
session.removeAttribute("aa");是会执行移除操作的
不是session.removeAttribute("zhi");
区别:获取的session是个map集合,而这个集合通过代理器递交给request.session的,删除session中的值而request.session还存在30分钟,框架默认值。
所以得用session.invalidate();使整个会话死亡,不然就会出现,在你在单点登录的时候,你注销了当前用户后,这个用户将会在30分钟内无法登陆!!!!