Do I need to create my own web.xml file?

JIA Java Italian Association

No, you don't. But it's normally better to.

Normally the servlet container knows how to execute servlets and what to call for executing jsps, so you can survive without defining your own web.xml file.

There are many advantages of the web application descriptor, though. For example if you have a servlet that it's part of a package, you would be able to assign it a name and a mapping, so instead of calling it, for example, with /servlet/com.foo.servlets.MyServlet, you can make it /MyServlet. Or, you can use a servlet name that it's common and when you change the class that you are using, you don't have to change the code or the pages that are using it.

Plus there are other interesting features, like parameter passing, securities and so on.

But, again, to answer to your question: yes, you don't need to create a web.xml file.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact