wood burning stoves 2.0*
The moose likes Servlets and the fly likes Is it necessary that an entry be made in web.xml for every servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Is it necessary that an entry be made in web.xml for every servlet" Watch "Is it necessary that an entry be made in web.xml for every servlet" New topic
Author

Is it necessary that an entry be made in web.xml for every servlet

Sajee Joseph
Ranch Hand

Joined: Jan 17, 2001
Posts: 200
Hello all,

Is it necessary that an entry be made in web.xml for every servlet ?
I believe that an entry in web.xml is required only if the Servlet needs initilization parameters?
Apart from this is there any situation which demands the need for an entry in web.xml??
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It is possible, but not advisable to run servlets without mapping them in your deployment descriptor (web.xml).

In Tomcat, you do this by re-enabling the invoker servlet (which is commented out in TOMCAT_HOME/conf/web.xml). You read why it's a bad idea here:
http://jakarta.apache.org/tomcat/faq/misc.html#evil


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
Ben, why not go ahead help him pull the trigger now that you've given him the gun to put to his head?

Seriously, though, it is highly advisable NOT to enable the "invoker" servlet. Alternatively, you could look at XDoclet if you don't like writing web.xml files. XDoclet will generate them for you based on javadoc tags in your code...


James Carman, President<br />Carman Consulting, Inc.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by James Carman:
Ben, why not go ahead help him pull the trigger now that you've given him the gun to put to his head?


He has given him the gun with a User Guide/Reference Manual (as provided a link on, why not).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it necessary that an entry be made in web.xml for every servlet