SSH框架下session失效跳转到登录页面 10
现在开发的系统是struts2+spring+hibernate框架的,现在遇到个问题,在session失效时,要跳到登录页面重新登录,会产生两种结果:一是导航菜单的if...
现在开发的系统是struts2+spring+hibernate框架的,现在遇到个问题,在session失效时,要跳到登录页面重新登录,会产生两种结果:一是导航菜单的iframe存在,登录页面显示在子iframe中;二是跳到登录页面了,但登录进去后的导航菜单的iframe不存在了
跳转是在spring的(Spring Security)安全权限管理手册配置文件中配置的
<http auto-config="true" access-denied-page="/accessDenied.jsp">
<intercept-url pattern="/login.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?error=true"
default-target-url="/loginSuccess.jsp" />
</http>
实在解决不了问题,望哪位大侠解救一下!!最好来个示例,谢谢啦!!
邮箱:229847511@qq.com
是具体的代码!!不要别的代码 展开
跳转是在spring的(Spring Security)安全权限管理手册配置文件中配置的
<http auto-config="true" access-denied-page="/accessDenied.jsp">
<intercept-url pattern="/login.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?error=true"
default-target-url="/loginSuccess.jsp" />
</http>
实在解决不了问题,望哪位大侠解救一下!!最好来个示例,谢谢啦!!
邮箱:229847511@qq.com
是具体的代码!!不要别的代码 展开
2个回答
展开全部
最好写个监听器,然后在监听里去判断是否过期,以便执行相应操作。我这有一份齐全的代码,说实话用这代码换你10积分太亏了~~~
public class CharacterEncodingFilter implements Filter {
private FilterConfig filterConfig;
private String enable;
private String encoding;
public CharacterEncodingFilter() {
filterConfig = null;
enable = null;
encoding = null;
}
public void destroy() {
filterConfig = null;
enable = null;
encoding = null;
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) throws IOException, ServletException {
if (enable.equals(SystemParam.PARA_ENABLE_VALUE_FALSE)) {
filterChain.doFilter(request, response);
return;
} else {
request.setCharacterEncoding(encoding);
filterChain.doFilter(request, response);
return;
}
}
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
enable = this.filterConfig.getInitParameter(SystemParam.PARA_ENABLE_NAME);
if (enable == null) {
enable = SystemParam.PARA_ENABLE_VALUE_TRUE;
}
encoding = this.filterConfig.getInitParameter(SystemParam.PARA_ENCODING_NAME);
}
}
拿分。
public class CharacterEncodingFilter implements Filter {
private FilterConfig filterConfig;
private String enable;
private String encoding;
public CharacterEncodingFilter() {
filterConfig = null;
enable = null;
encoding = null;
}
public void destroy() {
filterConfig = null;
enable = null;
encoding = null;
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) throws IOException, ServletException {
if (enable.equals(SystemParam.PARA_ENABLE_VALUE_FALSE)) {
filterChain.doFilter(request, response);
return;
} else {
request.setCharacterEncoding(encoding);
filterChain.doFilter(request, response);
return;
}
}
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
enable = this.filterConfig.getInitParameter(SystemParam.PARA_ENABLE_NAME);
if (enable == null) {
enable = SystemParam.PARA_ENABLE_VALUE_TRUE;
}
encoding = this.filterConfig.getInitParameter(SystemParam.PARA_ENCODING_NAME);
}
}
拿分。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询