Hello, I decided to try and implement a filter for my struts application. A filter that would check for a session object, and if it does not exist, send the user to a certain link.
Anyway, I found an example in the "Struts Cookbook" and I am implementing it. But for whatever reason, when I hit a page that should redirect me, I can see (by debug statements) that the filter is hit 10 or more times, and then I get an error stating: "Redirect limit for this URL exceeeded. Unable to load the requested page") in an alert Box? I would really like to get this going: Here is the code, and the web.xml I am using. Any help would be appreciated. CODE public class AppFilter implements Filter { private String onFailure = "index.jsp"; private FilterConfig filterConfig; public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; onFailure = filterConfig.getInitParameter("onFailure"); } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { Logger log = Logger.getLogger(this.getClass().getName()); HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; log.info("XXXXXXXXXXXXX"); log.info("AppFilter called for a request."); log.info("param onFailure=" + onFailure); // if the page is onFailure page continue down the chain if (req.getServletPath().equals(onFailure)) { log.info("YYYY equals YYYY"); chain.doFilter(request, response); return; } HttpSession session = req.getSession(); AppObject appObject = (AppObject)session.getAttribute("APP_OBJECT"); if (appObject == null) { log.info("AppObject is null, send to front door."); log.info("sending path=" + req.getContextPath() + onFailure); resp.sendRedirect(req.getContextPath() + onFailure); return; } else { log.info("DDDDDDDD"); chain.doFilter(request, response); } } public void destroy() { } } WEB.XML <filter> <filter-name>AppFilter</filter-name> <filter-class>com.mb.purcell.app.AppFilter</filter-class> <init-param> <param-name>onFailure</param-name> <param-value>/index.jsp</param-value> </init-param> </filter> <filter-mapping> <filter-name>AppFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> Thanks, Scott K Purcell --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]