Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to get the concept of Mapping a request URI to a servlet

 
deepa nari
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In book swcd certification by Hanumant Desmukh
Iam not able to understand the concept on page 77 Table 5.2 Mapping a request URI to a servlet...
Please i request anybody to clarify it.
Say for example if i say
I have HelloSevlet in http://localhost:8080/examples/servlet/HelloServlet
What is the request URI, Servlet Used , Servlet Path , Path Info??
 
deepa nari
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on page 77
Request URI
/color/red
ServletUsed
RedServlet
ServletPath
/red
PathInfo
null
and
Request URI
/colorapp/blue
Servlet Used
NONE
(ERROR MESSAGE)
Why is servlet used none do we have to name the servlet
isnt the servletpath blue and path info null for the /color/blue
 
Rasika Chitnis
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I very much agree with you. I found servlet mapping and uri mapping for .tld file (sections 5.2.3, 5.2.4 and
15.2.1 to 15.2.4) to be most confusing.

Given that the sub elements <servlet> and <servlet-mapping> of
<web-app> element are optional, (see the definition of <web-app> element given on page 87), what if I write
a servlet for my web application, but do not declare it in web.xml ? Can this servlet still accessible using
exact servlet name ?
On page 72, it says that the us-sales servlet can be accessed through the URL,
http://www.myserver.com/servlet/us-sales. Why /servlet is necessary ? In fact,
isn't context path i.e web application name missing in this ?
On page 77, how servlet path /red match /red/*, if /blue does not match /blue/ ?
On page 284, table 15.1, it says that we can use absolute URI for uri attribute in taglib directive
e.g. http://www.manning.com/taglibs. But, on page 289, it says 'If the specified uri attribute is an
absolute URI, then it is an error and is reported at translation time.'
Any thoughts on above points ?
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic