Create new JBoss Tools Documentation Jira issue

This will launch the Jboss Tools Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

Chapter 3. Projects

3.1. Creating a New JSF Project
3.2. Importing Existing JSF Projects with Any Structure
3.3. Adding JSF Capability to Any Existing Eclipse Project
3.4. Adding Your Own Project Templates
3.5. Relevant Resources Links

To take an advantage of JSF firstly you should perform one of the next steps:

In this section we're going to stop on each of them in detail.

If you want your project to already contain all JSF libraries, tag libraries and JSF configuration file, just organize a new brand JSF project. It is possible to do this easily with the help of the special wizard. To get it, select File > New > Project > JBoos Tools Web > JSF > JSF Project and click Next.


On the next form you'll be prompted to enter Project Name and select a location for the project or just leave a default path.

Here, JSF Version also allows you to select which JSF implementation to use.


There is a number of predefined project templates that are flexible and easily customizable. Thus you can pick a different template on which the projects Importing Existing should be based on. Almost all templates come in two variations: with jsf libraries and without ones.


The table below provides description for each possible JSF template.


On the next screen select what Servlet version to use and whether to register this application with JBoss AS (or other server) for running and testing your application.

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 creation without selecting Runtime. If you don't have any values, select New... to add new Runtime.

The Target Server allows you specifying 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.


When you are all done, you should have the project that has been appeared in the Package Explorer view:


At this point you can open faces-config.xml and start working on your application. There are a lot of features to develop JSF applications. We will describe the features further.

For detailed information on migration of JSF projects into a workspace see Migration Guide.

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 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.


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


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 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.


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. Thus, 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:


Once the file has been created, it should be opened in a special Faces Config Editor.

Template is a set of files that is served as a basis to facilitate the creation of a new project. Project templates provide content and structure for a project.

There is a powerful templating capability for creating new and importing existing Struts and JSF projects. This templating facility has a variety of aspects to consider. But, let's start with the most straightforward case and consider the process of creating a template from your existing JSF project.

Let's say you have a project that you want to use as the basis for a new template. Follow these steps to make a template out of it:


  • In the first dialog box, you can choose a name for the template (defaults to the project name) and confirm what run-time implementation of the project technology will be used


  • Select Next and you will be sent to a dialog box with your project structure displayed with check boxes. Here you can check only those parts and files in your project directory that should be part of the template


  • At this point, unless you want to designate some extra files as having Velocity template coding inside them, you should click Finish .

That's it. Now, you can use this template with any new or imported project that uses the same run-time implementation as the project you turned into a template.

At this point, you have a fully configured project and now you can bring some new logic to it starting from JSF configuration file.

You can find more in-depth explanation on how to work with special wizards, editors and views that can be used in various scenarios while developing JSF applications in our Visual Web Tools guide.