此内容没有您所选择的语言版本。
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-action
Copy 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 therestart
target in the generated project'sbuild.xml
file from within Eclipse. Alternatively, you can edit theresources/META-INF/application.xml
file in Eclipse.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 projectsrc
directory. Add a breakpoint to theping()
method, and click the button again. - 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 withseam test
or thetest
target of the generated build.