aspose file tools*
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 Java 8 in Action this week in the Java 8 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
I agree. Here's the link:
subject: How Servlets are retrieved from web.xml?
Similar Threads
mapping JSPs
Servlet Context / InitialContext
Initialization Parameters in servlet And in context-param
what should be the first servlet to display when application launches?