• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt on page 587 HFSJ  RSS feed

 
Khadija Lokhandwala
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
On page 587 HFSJ , be the Container exercise, we have to match the servlets according to the requests.
In request no.3 --> http://localhost:8080/MapTest/fooStuff/bar/blue.do
The answer given to it is DeployTestThree. But I think it should be DeployTestTwo because it matches the path /fooStuff/bar.

Could anyone please clarify on this.

Thanks in Advance.
 
chiranjeevi gunturu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Khadija ,
Observe the code again
 
chiranjeevi gunturu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Khadija ,
Observe the code below:


here there is no slash (/*) after "/fooStuff/bar" which means it matches with exact url-pattern only.So obviously it chooses the servlet name Three. Thank you
 
chiranjeevi gunturu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Observe the code below:

since there is no slash (/*) after "/fooStuff/bar" which matches for exact paths only it chooses servlet name Three.Thank you
 
Khadija Lokhandwala
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks..I got it..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!