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:
- JDK 6 (see Section 37.1, “Java Development Kit Dependencies” for details)
- 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.
- Execute the command:
seam new-action
seam new-actionCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Seam prompts for some information, and generates a new Facelets page and Seam component for your project.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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 therestarttarget in the generated project'sbuild.xmlfile from within Eclipse. Alternatively, you can edit theresources/META-INF/application.xmlfile in Eclipse.You do not need to restart JBoss each time you change the application. - Now go to
http://localhost:8080/helloworld/ping.seamand click the button. The code behind this action is in the projectsrcdirectory. Add a breakpoint to theping()method, and click the button again. - Finally, locate the
PingTest.xmlfile in the test package, and run the integration tests with the TestNG plug-in for Eclipse. You can also run the tests withseam testor thetesttarget of the generated build.