Este contenido no está disponible en el idioma seleccionado.
3.2. Setting up a new project
First, configure seam-gen for your environment. Just type the following in your command line interface:
cd seam_distribution_dir; seam setup
You will receive the following prompt for the required information:
The tool provides sensible defaults. To accept them, press Enter when prompted.
The most important choice here is whether to deploy your project as an
EAR or WAR archive. EAR projects support Enterprise JavaBeans 3.0 (EJB3) and require Java EE 5. WAR projects do not suppport EJB3, but can be deployed to a J2EE environment, and their packaging is simpler. If you have an EJB3-ready application server like JBoss installed, choose ear. Otherwise, choose war. This tutorial assumes you are using an EAR deployment, but you can follow these steps even if your project is WAR-deployed.
If you are working with an existing data model, make sure to tell seam-gen that tables already exist in the database.
Create a new project in our Eclipse workspace directory by typing:
seam new-project
This copies the Seam , type the Project name (in this case,
JARs, dependent JARs and the JDBC driver JAR to a new Eclipse project. It generates all required resources and configuration files, a Facelets template file and stylesheet, along with Eclipse metadata and an Ant build script. The Eclipse project will be automatically deployed to an exploded directory structure in JBoss as soon as you add the project. To add the project, go to helloworld), and then click Finish. Do not select Java Project from the New Project wizard.
If your default JDK in Eclipse is not a Java SE 5 or Java SE 6 JDK, you will need to select a Java SE 5 compliant JDK. Go to .
Alternatively, you can deploy the project from outside Eclipse by typing
seam explode.
The welcome page can be found at
http://localhost:8080/helloworld. This is a Facelets page (view/home.xhtml) created using the template found at view/layout/template.xhtml. You can edit the welcome page or the template in Eclipse, and see the results immediately by refreshing your browser.
XML configuration documents will be generated in the project directory. These may appear complicated, but they are comprised primarily of standard Java EE, and require little alteration, even between Seam projects.
There are three database and persistence configurations in the generated project.
persistence-test.xml and import-test.sql are used while running TestNG unit tests against HSQLDB. The database schema and test data in import-test.sql is always exported to the database before tests are run. myproject-dev-ds.xml, persistence-dev.xml and import-dev.sql are used during application deployment to your development database. If you told seam-gen that you were working with an existing database, the schema may be exported automatically upon deployment. myproject-prod-ds.xml, persistence-prod.xml and import-prod.sql are used during application deployment to your production database. The schema will not be exported automatically upon deployment.