wood burning stoves 2.0*
The moose likes Struts and the fly likes How Servlets are retrieved from web.xml? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How Servlets are retrieved from web.xml?" Watch "How Servlets are retrieved from web.xml?" New topic

How Servlets are retrieved from web.xml?

Charitha Charitha

Joined: May 07, 2006
Posts: 1

I am Charitha. I am new to AdvancedJava, though good at CoreJava. Can you please tell me how to run servlets, and the elements of web.xml, that is how to place the class name in web.xml, how it is retrieved during the execution of web application. It is very helpful if you explain me with a simple example.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you have the following entries in your web.xml file:

you can call MyServlet with the URL:


the <servlet-mapping> block tells the web container what URL will be used to call your servlet.

Consultant, Sima Solutions
It is sorta covered in the JavaRanch Style Guide.
subject: How Servlets are retrieved from web.xml?
Similar Threads
mapping JSPs
what should be the first servlet to display when application launches?
Servlet Context / InitialContext
Initialization Parameters in servlet And in context-param