JBoss.orgCommunity Documentation

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

2.1. Create standalone Seam Web Project
2.2. Selecting the Project Facets
2.2.1. Seam project with JPA facets
2.3. Java application building configuration
2.4. How to Configure Web Module Settings
2.5. Adding JSF Capabilities
2.6. Configure Seam Facet Settings

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

It is suggested that you use the specific Seam perspective that combines a number of different views and editors needed for work with resources concerned. For that select WindowOpen PerspectiveOtherSeam.

The Open Web Browser action is directly available in the Seam perspective.

Embedded Web Browser Button

Figure 2.1. Embedded Web Browser Button


The best way to get started with Seam is to create a simple Seam Project and experiment with it.

Thus, you should select FileNewOtherSeamSeam 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.


On the figure above you can see the runtime and the server already created.

If you need to create a new runtime, click on the New button in the Target Runtime section. It brings up the wizard where you can specify a new JBoss Server Runtime environment or the other type of runtime appropriate for your project configuration. Let's create one more JBoss Enterprise Application Platform 6.0 Runtime. Hence, after choosing it click on Next button.


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.


Clicking on Finish returns you to the Figure 2.2, “New Seam Project Wizard”.

The next step is to define a Server by clicking on New button in the Target Server section. In appeared New Server dialog the last server which matches the runtime will be selected.

All declared runtimes are listed in the combobox under the servers view. Here, you can indicate a server runtime that you need. Click Add if you want to add a new Server Runtime.


Next page allows you to verify the information for a chosen server. Leave everything as it is and click on Next.


On the last wizard step you can modify your projects to configure them on the Server.


Once you have the Target Server defined click on Finish button to return to the first page of the New Seam Project wizard.

Note

Refer to the Application Server Manager Guide to find out more about runtimes and servers.


The last section on this wizard step is Configuration. Here, you can select one of the predefined project configurations either associated with Seam 1.2, Seam 2.0 or with Seam 2.1. Furthermore, you can create your own configuration by pressing the Modify button. It will open the dialog which allows to configure your own set of facets for adding extra functionality to your project.

Pass to the next section to find out more details on this dialog.

The Project Facets wizard allows you to enable or disable specific facets which define necessary features for the project. When you switch to this wizard form, all critical facets are already checked for the chosen Configuration.

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


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


To see all available Server runtimes click on Runtimes tab on the left. You can create a new one using the New button. If more than one runtime is checked here, the Make Primary button will not be dimmed yet. Thus, you can make use of it to mark primary runtime.


Clicking the OK button will bring you to the Web Module wizard form again.

With this wizard you can define Java source directories which will be generated on build path. Also you can specify a default output folder. If you are agree with default values, press Next


As we deal with a Dynamic Web Application, we should at first specify the top level directory of our application for deploying it to a server afterwards. This kind of application contains Web resources, so it is important to indicate the content directory. The wizard will put all those values itself, so you can leave everything as is.


Choose Next to switch to the next wizard form.

This wizard helps you to add JSF capabilities to your project.

Choose Library provided by Target Runtime from Library Type list if you'd like to use a default JSF implementation given by the present runtime.


If you prefer to use your custom JSF implementation, choose User Library Item from Library Type list. In User Library list you can check required library.


If a new library is required, click Manage libraries... ( ) button. Then you should click New.


Here, it's necessary to type a Library Name.


To add proper Library JARs, click Add JARs... button and select the JARs on your hard drive.


You can download necessary JSF implementation libraries provided by Sun and Apache Foundation as well. Click Download... ( ) button and choose one of proposed libraries.


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.


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

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


  • Create Seam runtime and define Seam home folder.

For that click on Add button in the General section. Note, in the wizard shown below you can create a Seam runtime only for the version that was selected in the Section 2.2, “Selecting the Project Facets” wizard.


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

  • Enter EJB project name and EAR project name in case of EAR radio button is checked.

Note

If you want to name your web project "MyProject-war" the EJB project should not be "MyProject-war-ejb", it should be "MyProject-ejb". The same for EAR and Test projects' names. They should be respectively "MyProject-ear" and "MyProject-test".

In the Code Generation section the wizard has already provided the names for your Session Bean, Entity Bean and Test packages generation (optional). Of course, you can change them on others of your choice.


Click on Finish to generate a project.