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 jQuery in a portlet

In this recipe, we will create a stock watch list that utilizes jQuery to retrieve updated stock prices without refreshing the page.

Getting ready

The following are required for this recipe:

  • Apache Maven
  • An IDE of your choice
  • GateIn-3.2.0.Final-jbossas7-preview

How to do it...

To create a portlet that uses jQuery for Ajax calls:

  1. Create a new Maven project within your IDE, specifying Group Id: gatein.cookbook, Artifact Id: chapter10-jquery, and Packaging: war.
  2. Inside the project's pom.xml, add the following dependency:
         <dependency>
            <groupId>javax.portlet</groupId>
            <artifactId>portlet-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
  3. Create a class named WatchlistPortlet that extends javax.portlet.GenericPortlet ...

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