File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes The problem of servlet-name in the filter-mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "The problem of servlet-name in the filter-mapping" Watch "The problem of servlet-name in the filter-mapping" New topic
Author

The problem of servlet-name in the filter-mapping

Wei Geng
Greenhorn

Joined: Dec 10, 2004
Posts: 28
Hello,everyone

I found a problem when I set up the /ROOT/WEB-INF/web.xml. The case is

that when I change the setting as below:



the filter cannot be applied to the target servlet, but when I make the

the setting like this:



the filter was applied to the target servlet as expected.

My platform is WindowsXP(SP2)+J2sdk1.4.2_09+Tomcat5.5.12. I also

attempted to run the filter process as above on the platform of Tomcat4.3.1/Tomcat5.5.9. The problem remained.

I don't know what is wrong with my filter. Can you give me some advice?
Thank you!
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Where is your <servlet-mapping> element?

Note: Name of your servlets and filters must be fully qualified.
[ October 28, 2005: Message edited by: Adeel Ansari ]
Wei Geng
Greenhorn

Joined: Dec 10, 2004
Posts: 28


If I added the codes which are bold font into the web.xml the filter would run all right. However the filter could not be applied to the target servlet without the setting of the <servlet-mapping>.
When I read the book of "SCWCD 1.4 Study Guide", I found it was not be mentioned about these details.
I wonder about the relative between the <filter-mapping> and <servlet-mapping>.
Thank you.
[ October 28, 2005: Message edited by: Wei Geng ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The problem of servlet-name in the filter-mapping