File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Filter Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Filter Query" Watch "Filter Query" New topic
Author

Filter Query

Manish Agarwal
Ranch Hand

Joined: Jun 22, 2004
Posts: 34
Hi All,

I have these three files:

//Source Servlet: Source.java


//Destination Servlet: Destination.java


//Filter ParamAdder : ParamAdder.java



//web.xml



I am getting the output as "filterAdded :null ".I can't understand even after setting the request attribute in the Filter, it is giving null in the output.

Please help.

Thanks,


Thanks and Regards,<br />Manish Agarwal<br />SCJP 1.4 (100%)<br />SCWCD 1.4 (98%)<br />SCBCD 1.3 (Preparing)
Anupama Ponnapalli
Ranch Hand

Joined: Jun 12, 2006
Posts: 66
Hi,

The filter-mapping web.xml entry takes another child element, called Dispatcher. It can have 4 possible values: REQUEST, INCLUDE, FORWARD and ERROR. This determines the type of requests handled by the filter.

If this child element is missing, the default value is REQUEST. So, if your filter used Source as the servlet, it would work.

For destination, try this:

<filter-mapping>
<filter-name> ... </filter-name>
<url-pattern> ... </url-pattern>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

By the way, you can have upto 4 dispatcher elements, so you could very well write a mapping that ensures that all requests types are handled by the filter!

Cheers,
Anu
[ April 13, 2007: Message edited by: Anupama Ponnapalli ]
Manish Agarwal
Ranch Hand

Joined: Jun 22, 2004
Posts: 34
Thanks Anupama, that clears the doubt.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filter Query
 
Similar Threads
Overridding service Method
problem with jSF and Filter
Exception logging from servlets
HTTPUNIT error....
code using the filter is not working