[ Team LiB ] Previous Section Next Section

Q&A

Q1:

I can't seem to get my filter to work. What is the matter?

A1:

If your filters aren't working, it is usually one of two reasons. First, the container is having difficulty loading and initializing it. Check the server's logs to see if your filter is throwing an exception when the server instantiates or initializes it. Tomcat's log file is found at logs/Catalina.out. Otherwise, you might have made an error in the deployment descriptor. Look at the url-pattern element to make certain that it matches the URI of the resource you are trying to apply the filter to. Other configuration errors will likely result in entries in the log files. Also, make sure you are using a servlet container that supports filters. Tomcat did not support filters until version 4.


    [ Team LiB ] Previous Section Next Section