posted 14 years ago
Hi, Satya.
If we don't mention <dispatcher> element in <filter-mapping>, or mention it as empty like then it defaults to REQUEST.
Suppose if we send request to the container like, , then container selects the appropriate filters by seeing its <url-parttern> and <dispatcher> element. Here first it sees the 'FilterOne' url-pattern(/admin/*), this is ok, and it sees its <dispatcher> entry, here it is 'FORWARD', it skip this step and moves to the next ones, 'FilterThree' and 'FilterTwo', they satisfy the rules. Finally, it makes a mapping that first I(container) should call 'FilterThree' and after I should call 'FilterTwo'.
Incase if we use RequestDispatcher to forward request to any resource like calling,
then before forwarding to the resource that was present in 'admin' directory, first it checks the <filter-mapping>'s <dispatcher> declaration, like is there is 'FORWARD' present in it? Here it is present. Then it calls the 'FilterOne's doFilter() method and if our doFilter() contains then the resource will be forward to the 'result.jsp'.
SCJP5.0, SCWCD5.0, OCEJPAD6, OCPJWSD6