Ce contenu n'est pas disponible dans la langue sélectionnée.

3.3. Creating a new action


You can create a simple web page with a stateless action method by typing: seam new-action
Seam prompts for some information, and generates a new Facelets page and Seam component for your project.
Buildfile: build.xml

validate-workspace:

validate-project:

action-input:
    [input] Enter the Seam component name
ping
    [input] Enter the local interface name [Ping]

    [input] Enter the bean class name [PingBean]

    [input] Enter the action method name [ping]

    [input] Enter the page name [ping]


setup-filters:

new-action:
     [echo] Creating a new stateless session bean component with an action method
     [copy] Copying 1 file to C:\Projects\helloworld\src\hot\org\jboss\helloworld
     [copy] Copying 1 file to C:\Projects\helloworld\src\hot\org\jboss\helloworld
     [copy] Copying 1 file to C:\Projects\helloworld\src\hot\org\jboss\helloworld\test
     [copy] Copying 1 file to C:\Projects\helloworld\src\hot\org\jboss\helloworld\test
     [copy] Copying 1 file to C:\Projects\helloworld\view
     [echo] Type 'seam restart' and go to http://localhost:8080/helloworld/ping.seam

BUILD SUCCESSFUL
Total time: 13 seconds
C:\Projects\jboss-seam>
Copy to Clipboard Toggle word wrap
Since we have added a new Seam component, it is necessary to restart the exploded directory deployment. You can do this by typing seam restart, or by running the restart target in the generated project's build.xml file from within Eclipse. Alternatively, you can edit the resources/META-INF/application.xml file in Eclipse.

Note

You do not need to restart JBoss each time you change the application.
Now go to http://localhost:8080/helloworld/ping.seam and click the button. The code behind this action is in the project src directory. Add a breakpoint to the ping() method, and click the button again.
Finally, locate the PingTest.xml file in the test package, and run the integration tests with the TestNG plugin for Eclipse. You can also run the tests with seam test or the test target of the generated build.
Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat