What is the difference between Web Fragment Project and Dynamic Web Project on Eclipse? Which one would you recommend to use for building a clean structural website?
IBM defines Web Fragment as follows:
A web fragment is a logical partitioning of the web application in such a way that the frameworks being used within the web application can define all the artifacts without requiring you to edit or add information in the
web.xml
.
Furthermore:
A web fragment is a mechanism for either defining or extending the deployment descriptor of a web application by means of pluggable library jars that contain both the incremental deployment information (in the
web-fragment.xml
) and potentially any related or relevant classes. The web fragment is also packaged as a library (jar), with theweb-fragment.xml
in theMETA-INF
directory. Consequently, the web fragment project is essentially a Utility project, with the addition of a web fragment facet to it. The web fragment facet enables you to add relevant context-sensitive functionality to the fragment project.
Essentially, Web Fragments (introduced in Servlet 3.x) allows you to create a reusable portion (or fragment) of the deployment descriptor, web.xml
.
So, if you want to create a complete, dynamic web application, create a "Dynamic Web Project" in Eclipse. Essentially, you need web.xml
for the application server/container to deploy your application and "Dynamic Web Project" helps with this approach.
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With