Can I have two web.xml files in a single web application?

后端 未结 2 1747
無奈伤痛
無奈伤痛 2021-01-19 03:07

Can i Have a single application with more than one web.xml files? And can two applications have a parent child relationship so that there are two web.xml?

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-19 03:56

    For below servlet 3.0 you cannot.

    If you are using 3.0 there is a possibility.

    In JSR 315: Java Servlet 3.0 Specification, web-fragment.xml is introduced for pluggability of library jars which are packaged under WEB-INF/lib. The content of web.xml and web-fragment.xml are almost the same. One can define servlets, filters and listeners there. One can also specify metadata-complete=true in a given web-fragment.xml. In the latter case, the annotation processing of classes in that jar would be skipped. With web-fragment.xml, library jars can be self-contained and provide web related metadata information.

    For sure, having two xml creates confusion and besides all, If you explain whats your exact requirement, you'l get a good/standard solution for your problem.

提交回复
热议问题