O'Reilly logo

GateIn Cookbook by Piergiorgio Lucidi, Luca Stancapiano, Ken Finnigan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using portlet events in JSF 2

Update the JSF 2 order portlet from the first recipe to send an event when an order is saved, and create a new portlet to display a list of active orders.

Getting ready

The following are required for this recipe:

  • Apache Maven
  • An IDE of your choice
  • GateIn-3.2.0.Final-jbossas7-preview
  • Order-JSF project from Creating a JSF 2 portlet

How to do it...

To modify the existing order portlet to fire an event:

  1. Inside the project's pom.xml, add the following dependency:
      <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <scope>provided</scope>
        <version>2.1</version>
      </dependency>
  2. Create a class named OrderEvent within a package named gatein.cookbook.chapter10 with the following content:
    @XmlRootElement public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required