JBoss.orgCommunity Documentation
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.
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.
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.
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 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.
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 .
On the last wizard step you can modify your project to configure it on server.
Once you have the Target Server defined click on Finish button to return to the first page of the New Seam Project wizard.
We suggest that you look through our AS 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 pre-defined project configurations either associated with Seam 1.2 or with Seam 2.0. 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 characteristics for the project. In time 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 Save 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 runtimes are checked here, the Make Primary button won't be dimmed yet. So you can make use of it to mark primary runtime.
Ok button will bring you to the Web Module wizard form again.
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.
Choose Next to switch to the next wizard form.
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.
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.
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.
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.
Finally, as 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. 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).
Select EAR or WAR deployment by checking a necessary radio button.
Select a Database Type
and then specify a Connection profile appropriate for your database.
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.
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.
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.
Click on Finish to generate a project.