Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How Servlets are retrieved from web.xml?

 
Charitha Charitha
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

Thanks,
Charitha.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have the following entries in your web.xml file:



you can call MyServlet with the URL:

http://www.mycompany.com/myapplication/MyWonderfulServlet

the <servlet-mapping> block tells the web container what URL will be used to call your servlet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic