This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes servlet mapping - sybex book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "servlet mapping - sybex book" Watch "servlet mapping - sybex book" New topic
Author

servlet mapping - sybex book

jack nick
Ranch Hand

Joined: Jan 11, 2001
Posts: 96
Hello there,
now this is getting real bad. Is it just me with my interpretations of what I read or is it false what the book says.
pg 107 sybex book on the web component certification
"If mapping information is not included, the container will look to default directories defined by the servers deployement descriptor"
This statement gave me the impression that the mapping element in the web xml file helps the container find where the physical location of the servlet class file is. in reality according to the specification the mapping just lets us have a URL pattern that can be mapped to a servlet.
Also from my little understanding the servlet class files seemingly can be stored only in the WEB-INF directory. Could someone please clarify if there is way to store my servlets in any other location and then have some sort of mapping to this.
Thanks a lot
Jack
Sudd Ghosh
Ranch Hand

Joined: Oct 23, 2002
Posts: 187
I am also new to servlets, so the following is only what I understood so far. If it is totally incorrect, please accept my apologies and correct me.
I believe the hierarchy starting from WEB-INF is fixed. We have to follow this. The only variation may be a directory/package you place after "classes" and follow it thru in the <servlet>, <servlet-class>. Whatever is before that, I think, should be governed by the top-level mapping present in server.xml. The default mapping tells the web-server/container to look at webapps/examples/WEB-INF/classes for the servlets.
Can someone explain what all needs to be changed in server.xml (or anywhere else) in case I want my servlet classes to be accessed from the path webapps/myservlets/WEB-INF/classes ?
Thanks, Sudd


SCJP 1.4, SCWCD, SCBCD 1.3
friso jonge
Ranch Hand

Joined: Aug 06, 2002
Posts: 41
can anyone please answer this, since this is what the book says. "mapping can be used for linking to classes outside the web-inf directory."
so is that true ??
Sudd Ghosh
Ranch Hand

Joined: Oct 23, 2002
Posts: 187
Hi Friso -
Please see the thread on "unable to execute" which related to this problem.
Thanks, Sudd
 
GeeCON Prague 2014
 
subject: servlet mapping - sybex book