How to Creating Web fragment projects ?

Steps by Step guide for creating Web fragment projects / web module or module project in java.

You can use the Web fragment project wizard to create Web fragment projects in your workspace.

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. It can include almost all the same elements that the web.xml descriptor uses, with these requirements:

  • The top level element for the descriptor must be web-fragment
  • The corresponding descriptor file must be called web-fragment.xml
If a framework is packaged as a jar file and has metadata information in the form of deployment descriptor, then the web-fragment.xml descriptor must be in the META-INF/ directory of the jar file. 

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 the web-fragment.xml in the META-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.

The stage needs to be set just so.
  1. In the Java EE perspective, select File > New > Web Fragment Project. Alternatively, right-click the Enterprise Explorer context menu, and select New > Web Fragment Project . The Web fragment wizard opens.
  2. In the Name field, type a name for the Web fragment project. To change the default Project contents, click the Browse button to select a new location. If you specify a non-default project location that is already being used by another project, the project creation fails.
  3. The Target runtime field is pre-populated with the selection from the enterprise project.
  4. Optional: Select a pre-defined project configuration from the Configurations drop-down list.
  5. Optional: If you want to modify the configuration details, click modify:
  6. Optional: Select one or more project facets from the Project Facets list. To specify server runtime environments, click Show Runtimes and select one or more runtimes. After making your selections, you can save your custom configuration by clicking Save.
  7. Optional: Select the Add project to Dynamic Web project check box to add the new module to an enterprise module (WAR) project. Type a new project name or select an existing enterprise module project from the drop-down list in the Dynamic Web project name combination box. Or, click New to launch the New EAR module Project wizard.
  8. Select Add project to working sets to add the Web fragment project to an existing working set, or click Select to locate a working set, and click Next.
  9. On the Configure project for building a Java application page, on the Source folders on build path field, click Add Folder... to add folders for your source on the build path, or accept the default value (src).
  10. In the Default output Folder: field, specify a folder for your output files or accept the default value (bin), and click Finish.


Post a Comment

Please provide your valuable comment.

Newer Post Older Post Home


Powered by Blogger.


Custom Search