This content has been marked as final.
Show 1 reply
-
1. Re: Forcing redirection to a specific page with j_security_c
lost_traveller Dec 5, 2006 8:03 AM (in response to lduperval)I needed this too and after searching the forums it appears lots of people ask this question, the answer is that there is no neat solution, your best solution is to write a javax.servlet.Filter for every page that sets some session attribute when the user is logged in, e.g.
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpSession session = ((HttpServletRequest)request).getSession(); if(session.getAttribute("login_flag") == null) { session.setAttribute("login_flag", "1"); servletContext.getRequestDispatcher(welcomePage).forward(request, response); } else { chain.doFilter(request, response); } }
Its not nice but it works.