△△もっとStrutsの良さを教えてくださいSession5at TECH
△△もっとStrutsの良さを教えてくださいSession5 - 暇つぶし2ch615:デフォルトの名無しさん
08/02/14 22:19:27
>>614
こんなフィルタ作ってみたんだけどダサいかな?突っ込みキボンヌ。エロイ人。

public class SessionFilter extends FilterDispatcher {
@Override
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpReq = (HttpServletRequest) req;
String userId = (String) httpReq.getSession().getAttribute("userId");
if (StringUtils.isEmpty(userId)) {
if (!httpReq.getServletPath().equals("/login.action")
&& !httpReq.getServletPath().equals("/login!input.action")) {
((HttpServletResponse) res).sendRedirect("login!input.action");
return;
}

}
super.doFilter(req, res, chain);
}
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch