2.1.3.3. Adding JSF Capability to Any Existing Eclipse Project

With JBoss Developer Studio it's also possible to add JSF capability (JSF libraries, tag libraries) to any existing Eclipse project in your workspace. After that you'll be able to make use of such JBoss Developer Studio editors as JSF configuration editor, JBoss Tools JSP editor and any others.

Right click the project and select JBoss Tools > Add JSF Capabilities. This will start the process of adding all necessary libraries, files to make this a Web JSF project.

Adding JSF Capabilities

Figure 2.15. Adding JSF Capabilities


The wizard will first ask you to show the web.xml file location and the project name.

Project Location

Figure 2.16. Project Location


On the last form you can set the different folders for your project as well as register this application with a servlet container.

Make sure to select Add Libraries for JBoss Developer Studio to add all required JSF related libraries to this project.

The Context Path is the name under which the application will be deployed.

The Runtime value tells Eclipse where to find Web libraries in order to build (compile) the project. It is not possible to finish project import without selecting Runtime. If you don't have any values, select New... to add new Runtime.

The Target Server allows you to specify whether to deploy the application. The Target Server corresponds to the Runtime value selected above. If you don't want to deploy the application, uncheck this value.

Project Folders

Figure 2.17. Project Folders


Once your project is imported you can see that JSF related libraries have been added to your project: jsf-api.jar and jsf-impl.jar .

Note:

Some application servers provide their own jsf implementation libraries. So, to avoid conflicts you should not add jsf libraries while adding jsf capabilities.

You are now ready to work with JSF by creating a new JSF configuration file:

Creating a New JSF Configuration File

Figure 2.18. Creating a New JSF Configuration File