5.3. Creating a new action
Task:
This task will show you how to create a simple web page with a stateless action method.
Procedure 5.1.
- Execute the command:
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> - As 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. - 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.