△△もっとStrutsの良さを教えてくださいSession5
at TECH
615:デフォルトの名無しさん
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
4461日前に更新/258 KB
担当:undef