Hi, I did not mean to cross post. I sent out the following question a few minutes ago, 
but my mail server was having a problem so I am not sure if it was through or not! I 
am sending it using a different account.
 
 

I implemented Filter interface and set it up in my Tomcat container. The
funning thing is that only the init() and destroy() methods get executed
when I start and shut the server, the doFilter HOWEVER does not get
executed when I make a request from the web page.
Am I missing something obvious?
Here is my code:
public class MyFilter implements Filter {
  public void init(FilterConfig filterConfig) throws ServletException {
    /[EMAIL PROTECTED] Implement this javax.servlet.Filter method*/
System.out.println("************************************************************
*");
    System.out.println("My fuilter init");
  }
  public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
    /[EMAIL PROTECTED] Implement this javax.servlet.Filter method*/
System.out.println("************************************************************
*");
    System.out.println("My filter do fuilter");
    chain.doFilter(request,                                                           
response);
  }
  public void destroy() {
    /[EMAIL PROTECTED] Implement this javax.servlet.Filter method*/
System.out.println("************************************************************
*");
    System.out.println("My filter destroy");
  }
}
Here is web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by chang zhou
(UBH) -->
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>
<web-app>


<display-name>Struts Example Application</display-name>
 
<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>ubh.web.servlet.UBHActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>mapping</param-name>
<param-value>ubh.web.action.UBHActionMapping</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<filter>
    <filter-name>MyFilter</filter-name>
    <filter-class>filter.MyFilter</filter-class>
</filter>
<!-- The Welcome File List -->

<session-config>
<session-timeout/>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Application Tag Library Descriptor -->
<taglib>
<taglib-uri>/WEB-INF/app.tld</taglib-uri>
<taglib-location>/WEB-INF/app.tld</taglib-location>
</taglib>
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
</web-app>
 



---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

Reply via email to