Chapter 2. Creating a New Seam Project via the New Seam Project wizard

In this chapter we provide you with the necessary steps to start working with Seam Framework.

At first, we suggest setting the specific Seam perspective that combines a number of different views and editors needed for work with resources concerned. For that select Window > Open Perspective > Other > Seam or you can also access it through the button in the right top corner.

Seam Perspective

Figure 2.1. Seam Perspective


2.1. Create standalone Seam Web Project

The best way to get started with Seam is to organise a simple Seam Project and experiment with it by creating variations.

Thus, you should select File > New > Seam Web Project to run the New Seam Project wizard. The wizard form allows you to create runtime and server instances in order to get started creating, running, and debugging J2EE (only) applications.

Seam Web Project wizard has an option for selecting the actual Server (not just WTP runtime) that will be used for the project. This allows the wizard to identify correctly where the required datasource and driver libraries need to go.

Let's get through the wizard step-by-step. First, you should enter a name and a location directory for your new project.

New Seam Project Wizard

Figure 2.2. New Seam Project Wizard


Clicking on New... button in the Target Runtime section will bring you to another dialog. Here, you can specify a new installed Runtime environment or the other type of runtime appropriate for configuring your project. Let's create a JBoss 4.2 Runtime. For that after choosing it click on Next button.

Specifying Target Runtime

Figure 2.3. Specifying Target Runtime


All what you need here is to name runtime, type the path to its install directory or locate it by using Browse button, select a Java Runtime Environment, and select which configuration you want.

Specifying Target Runtime Configurations

Figure 2.4. Specifying Target Runtime Configurations


Clicking on Finish returns you to the previous dialog. The next step is to define an installed server that you can do by clicking on New... button in the Target Server section. In appeared Server Dialog it's possible to select a server version.

If the chosen server has already got an installed runtime, there appears a combo box with all declared runtimes under the servers view. Here, you can indicate a server runtime that you need. Use Installed Runtimes... button to see or edit which runtimes are installed. If there is no any declared runtime for chosen server, click on Next to specify it on the next preferences page.

Specifying Target Server

Figure 2.5. Specifying Target Server


Next dialog allows you to verify the information for chosen server, set login credentials to authorize an access to the server and specify a directory for deploying. Leave everything as it is and click on Next .

Specifying Server Configurations

Figure 2.6. Specifying Server Configurations


On the last wizard step you can modify your project to configure it on server.

Project Modification for Configuring on the Server

Figure 2.7. Project Modification for Configuring on the Server


After clicking on Finish button you should have the following wizard view:

Completion of Runtime and Server Configuration

Figure 2.8. Completion of Runtime and Server Configuration


The last section on this wizard step is Configurations. Here, you can select one of the pre-defined project configurations either associated with Seam 1.2 or with Seam 2.0 that is the latest release but just only a technology preview. In addition, you can create your own configuration. Choosing Default Configuration for jBoss 4.2 Runtime allows you later to specify your own set of facets for adding extra functionality to your project. For more details about facets, see next section. Besides, we suggest that you look through our AS manager guide to find out more about runtimes and servers.

Having all necessary options arranged, click on Next to pass on to the other wizard.

2.2. Select the Project Facets

This page of the wizard allows you to enable or disable specific facets that define necessary characteristics for the project. In time you switch to this wizard form, all critical facets are already checked for the chosen Dynamic Web Project.

Notice that this page of the wizard also allows you to specify the necessary version for any facet.

Project Facets Selection

Figure 2.9. Project Facets Selection


Moreover, you can specify your own preset of selected facets by checking needed ones in project facets window and clicking on Save button.

Specifying Custom Facet Preset

Figure 2.10. Specifying Custom Facet Preset


You can also see all available runtimes after clicking on Show Runtimes or create new ones using the New button.

Runtime Manipulations

Figure 2.11. Runtime Manipulations


Here, if more than one runtimes are checked, the Make Primary button won't be dimmed yet. So you can make use of it to mark primary runtime.

Next button will bring you to the Web Module wizard form.

2.3. How to Configure Web Module Settings

As we deal with a Dynamic Web Application we should first specify the top level directory of our application for deploying it to a server afterwards. You know, this kind of application contains both Web and Java code resources. Thus, it's also important to indicate the content directory as well as Java source directory. The wizard will put all those values itself. So you can leave everything as it is.

Web Module Settings

Figure 2.12. Web Module Settings


Choose Next to switch to the next wizard form.

2.4. Adding JSF Capabilities

This wizard helps you to add JSF capabilities into your project for representing appropriate behaviours associated with JSF.

Checking Server Supplied JSF Implementation means that you will have a default JSF implementation given by server.

Adding JSF Capabilities to Web Project

Figure 2.13. Adding JSF Capabilities to Web Project


In case when you want to use your custom JSF implementation check a lower radio button. You are able to create a library of jars by clicking on New button.

Here, it's necessary to type a Library Name, select a Version Supported and add proper Library jars. Then click on Finish to complete the choice.

Create JSF Implementation Library

Figure 2.14. Create JSF Implementation Library


In the Component Libraries section of the wizard you can also add Component Libraries (e.g. Richfaces). Just click on New button. Appeared dialog will ask you to type the Library name, supported version and add necessary jar's. Press Finish to complete the choice.

Create JSF Implementation Component Library

Figure 2.15. Create JSF Implementation Component Library


The last wizard options allows to edit a path for JSF Configuration File, a name for JSF Servlet, JSF Servlet Classname and change URL Mapping Patterns.

JSF Capabilities Wizard

Figure 2.16. JSF Capabilities Wizard


Finally, as we are arranging the Seam Web project, the last step we should do is to adjust project configurations associated with the Seam.

2.5. Configure Seam Facet Settings

The last wizard step is related to Seam facet and allows you to do the following:

Seam Facet Settings

Figure 2.17. Seam Facet Settings


  • Create Seam runtime and define Seam home folder.

For that click on Add button in the General section. Notice that in this wizard presented below you can create a Seam runtime only for that version which was selected in the Project Facets wizard (version 1.2 in our case).

Seam Runtime Creation

Figure 2.18. Seam Runtime Creation


  • Select EAR or WAR deployment by checking a necessary radio button.

  • Select a Database Type

Seam Runtime Creation

Figure 2.19. Seam Runtime Creation


  • and then specify a Connection profile appropriate for your database.

Connection Profile Options

Figure 2.20. Connection Profile Options


You can edit chosen profile by using Edit button or organise a new one by clicking on New button and selecting necessary for you type of connection profile.

Connection Profile Selecting

Figure 2.21. Connection Profile Selecting


On the other dialog you'll be asked to enter its name and description. And then you should select a proper driver and adjust connection details. Press Next to preview all the adjusted settings and complete the creation of the new profile.

Connection Details

Figure 2.22. Connection Details


The next block of settings in the Seam Facet wizard are describing a Database and a connection to it.

In the Code Generation section the wizard have already put the names for your Session Bean, Entity Bean and Test packages. Of course, you can change them into the others which you like.

Code Generation Section

Figure 2.23. Code Generation Section


Click on Finish to generate a project.