• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filters query

 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read p - 678 as IMPORTANT note on filter, i could get that whatever filters are descided from url-pattern or servlet-name are invoked in the order in which they are declared in web.xml, but why answer of second question shows that 1,5,2 where as 2 is coming before 5.

Could anybody explain me briefly that what is matter actually for deciding the order sequence, i do not want to miss the question related to this in exam.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even I found the same question confusing. Only after posting it, I found this post.
 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jothi,

Now i got what actually it is. Intially took it in wrong way.

It is mentioned in book that sequence is decided in the order in which the filters declared. But the first preference to those which are declared with url-pattern and second with servlet-name.

So first we count all those with <url-pattern>(which are matched) and make an order and then count remaining with <servlet-name>.

That is why answer of second question is 1,5,2
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mistook it while answering that particular question. I guessed that all the 5 mappings use url-pattern. Thanks for pointing that out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic