Javatpoint Logo

can i execute the servlet program without creating the web.xml

By: vipink*** On: Wed Mar 15 18:32:43 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
can i execute the servlet program without creating the web.xml file in our program if yes then why do we need the web.xml file for a program Up0Down

 
First of all we will see what is web.xml and what it does?
web.xml is Deployment Descriptor which is used for mapping regarding servlet.

The role of web.xml file is that when you execute web application it will search from which page to execute application.
Means if you created any application and when you set your welcome page name in web.xml as <welcome-file>myhome.html</welcome-file> then application
start executing from this page.
Basically it is used to set execution of your project file order.

And yes we can execute code without setting file name in web.xml file.

A welcome file is the file that is invoked automatically by the server, if you don't specify any file name.

by default it will automatically select this order :

welcome file order list in web.xml

1)index.html
2)index.htm
3)index.jsp

If none of these files are found in web.xml, it will give you 404 error.

Image Created0Down

By: [email protected] On: Sun Mar 19 09:15:58 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No