Este contenido no está disponible en el idioma seleccionado.

3.3. Creating a new action


Task:

This task will show you how to create a simple web page with a stateless action method.

Prerequisites:

  • JBoss Enterprise Application Platform 5.
  • Ant 1.7.0.
  • Recent versions of Eclipse, the JBoss IDE plug-in and the TestNG plug-in correctly installed.
  • Add your JBoss installation to the Server View in Eclipse.
  • JBoss Enterprise Application Platform running in debug mode.
  • A command prompt in the directory where you unzipped the Seam distribution.

Procedure 3.2. 

  1. Execute the command:
    seam new-action
    Copy to Clipboard Toggle word wrap
  2. 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
  3. 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.
    You do not need to restart JBoss each time you change the application.
  4. 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.
  5. Finally, locate the PingTest.xml file in the test package, and run the integration tests with the TestNG plug-in for Eclipse. You can also run the tests with seam test or the test target of the generated build.
Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat