Hi, I am attempting to create a simple JSP Filter for my Struts-based application. The filter is supposed to print a line to stdout any time a JSP is accessed.
The problem I am having is that when I access my JSPs with the following filter mapping, I am not able to see the output in stdout. It's almost like the jsp is not found with the below <url-pattern>:
However, if I use a mapping like the one below, then I am able to see the output in stdout for every JSP and every other resource accessed:
My goal is find a way to only see the ouptut in stdout for JSPs and not everything else. Please advise! Thanks!
posted 10 years ago
I figured out the answer to my own question. In Tomcat 4.1.31 (servlet spec 2.3), the <filter-mapping> only applies to requests (for example, from a browser). So the filters are not applied to the Struts FORWARDS.
However in Tomcat 5 (servlet spec 2.4), there is NEW support for a <dispatcher> element with FORWARD.
I am surprised that I was not able to find this answer on a search engine since it would appear to be fairly common. Anyway, for anyone interested, check out the 2.4 servlet spec on page 55 for details.