當前位置:編程學習大全網 - 源碼下載 - SSH框架下session失效跳轉到登錄頁面

SSH框架下session失效跳轉到登錄頁面

最好寫個監聽器,然後在監聽裏去判斷是否過期,以便執行相應操作。我這有壹份齊全的代碼,說實話用這代碼換妳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);

}

}

拿分。

  • 上一篇:大話西遊手機遊2月16維修公告
  • 下一篇:qt助手手機版安卓版Qt助手安卓版
  • copyright 2024編程學習大全網