Articles about Java and EE
Ce billet est la suite de l'article : Créer un projet Seam - Tutorial Seam partie 2
Nous allons créer une première page web que nous appellerons crudAnimals.
Pourquoi ce nom bizarre ? L’objectif ce tutoriel est de montrer comment faire uncrud sur une entité Animal. CRUD signifie Create Read Update Delete, c a d que nous allons faire une seul page qui permet de Créer Lire Modifier Mettre à jour Supprimer un animal dans notre base de donnée.
Pour créer une première page, le plus simple est de demander à SEAM de le faire.
Aller en ligne de commande dans le projet helloworld SEAM et tapez :
C:/devjava/workspace/helloworld> C:/devjava/workspace/jboss-seam-2.0.1.GA/seam new-action
Vous pouvez tapez directement seam new-action si vous avez mis le répertoire de jboss-seam-2.0.1.GA dans le path de windows.
Ceci va créer la page SEAM et son action web :
C:/devjava/workspace/helloworld>..jboss-seam-2.0.1.GA/seam new-action
Unable to locate tools.jar. Expected to find it in C:/Program Files/Java/jre1.6.0_04/lib/tools.jar
Buildfile C:/devjava/workspace jboss-seam-2.0.1.GA/seam-gen/build.xml
init:
init-properties:
[echo] C:/Program Files/jboss-4.2.2.GA
validate-workspace:
validate-project:
action-input:
[input] Enter the Seam component name
crudAnimals
[input] Enter the local interface name [CrudAnimals] [CrudAnimals]
[input] Enter the bean class name [CrudAnimalsBean] [CrudAnimalsBean]
[input] Enter the action method name [crudAnimals] [crudAnimals]
[input] Enter the page name [crudAnimals] [crudAnimals]
setup-filters:
new-action-ear:
[echo] Creating a new stateless session bean component with an action method
[copy] Copying 1 file to C:devjavaworkspace /helloworld/src
/action/com/getj2ee/tuto/seam/helloworld
[copy] Copying 1 file to C:devjavaworkspace /helloworld/src
action/com/getj2ee/tuto/seam/helloworld
[copy] Copying 1 file to C:devjavaworkspace /helloworld/src
test/com/getj2ee/tuto/seam/helloworld/test
[copy] Copying 1 file to C:devjavaworkspace /helloworld/src
test/com/getj2ee/tuto/seam/helloworld/test
[copy] Copying 1 file to C:/devjava/workspace /helloworld/view
[echo] Type 'seam restart' and go to http://localhost:8080/helloworld/crudAnimals.seam
new-action-war:
new-action:
BUILD SUCCESSFUL
Total time: 45 seconds
C:devjavaworksaqcehelloworld>
Retourner dans Eclipse. Rafraichir le projet. Et relancer JBoss.
Aller à l’adresse http://localhost:8080/helloworld/crudAnimals.seam pour voir apparaitre la nouvelle page
Références :
Tuto seam Partie 1 : Installer SEAM et JBoss
Tuto seam Partie 2 : Creer un projet SEAM
La doc de seam : http://www.seamframework.org/Documentation
Installer Ant : http://java.developpez.com/articles/ant/partie2/