mdev
mdev

Reputation: 472

Servlet Mapping. Web.xml

In java web application is it possible to map servlets in files that are not "web.xml"? I mean. I will need to map over a hundred servelts and web.xml would be dificult to deal with. Dividing the mappings in several file by cathegory would be great.

If there is some way please would you tell me how?.

Thank you very much.

Upvotes: 0

Views: 440

Answers (2)

Ramesh PVK
Ramesh PVK

Reputation: 15456

Yes. Servlet 3.0 provides Pluggability Feature which allows you to define web artifacts using:

  • Web Fragments. The libraries inside WEB-INF/lib can have META-INF/web-fragment.xml which can define part of full deployment descriptor.
  • Annotations. You can define Servlet, Filters and Listeners using @WebServlet, @WebFilter and @WebListener annotation.

Upvotes: 0

rizzz86
rizzz86

Reputation: 3990

Not sure about dividing web.xml file. But you can achieve your task by defining your servlets through Java Annotations instead of defining them in web.xml. The Servlet 3.0 specification provides a new annotation @WebServlet that can be used to declare your servlets.

Upvotes: 1

Related Questions