Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ doubt page 31

 
Nishant Dhar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ... maybe I am missing something conceptually .. all help appreciated

on page 31 (HFSJ), the 8th point says
http://localhost:8080/ch1/serv1

isnt the above line trying to access a servlet directly, since /serv1 maps to Ch1Servlet.class
my point is that Ch1Servlet.class is within WEB-INF. i read somewhere that anything within WEB-INF cannot be served/accessed directly by the client.
isnt this a contradiction

nishant
 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This URL http://localhost:8080/ch1/serv1 need not be pointing to servlet directly. In web.xml you can have mapping for /serv1 to actual servlet.

you will learn more on servlet mapping and url-patterns in chapters to follow.
 
Nishant Dhar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i see ..so I guess that means that if the /serv1 maps to a servlet in WEB-INF then it is ok to type such a URL
 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are correct. Even if it doesnt match, you will get a 404 error page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic