JBoss.orgCommunity Documentation
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
→ → → .The Seam perspective.
action is directly available in theThe best way to get started with Seam is to create a simple Seam Project and experiment with it.
Thus, you should select 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.
→ → → → to run theSeam 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 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 button.
button in theAll what you need here is to name runtime, type the path to its install directory or locate it by using
button, select a Java Runtime Environment, and select which configuration you want.Clicking on Figure 2.2, “New Seam Project Wizard”.
returns you to theThe next step is to define a Server by clicking on Target Server section. In appeared New Server dialog the last server which matches the runtime will be selected.
button in theAll declared runtimes are listed in the combobox under the servers view. Here, you can indicate a server runtime that you need. Click
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
.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 New Seam Project wizard.
button to return to the first page of theRefer 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 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
button.To see all available Server runtimes click on Runtimes tab on the left. You can create a new one using the button. If more than one runtime is checked here, the button will not be dimmed yet. Thus, you can make use of it to mark primary runtime.
Clicking the Web Module wizard form again.
button will bring you to theFor creating a Seam project with JPA support you need to select Java Persistent facet on Project Facets page and click .
Then press Next and you can use the default value on the Java application building page
After that you will see JPA facet page.
On this page you can choose Platform (vendor-specific JPA implementation) for your project, type of JPA Implementation, and configure the Connection to database in the Connection area.
The next page concerns Web Module Settings. Accept the default values and press the button.
On the next step you will see JSF Capabilities and Seam facet pages, which are mostly the same as in general Seam project.
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
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
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 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.
button in theSelect 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.
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
to generate a project.