Author: Ken Finnigan, Peter Palaga
Level: Intermediate
Technologies: Portlet, CDI, JSF
Summary: An application that demonstrates use of JSF 2 RI and CDI in a portlet
Target Product: GateIn
Source: https://github.com/gatein/gatein-portal-quickstart
This project demonstrates how to use CDI and JSF in portlets. We have made the example as self-explaining as possible through commenting all necessary details directly in the included files. We suggest to study the example in the following order:
pom.xml
src/main/webapp/WEB-INF
src/main/java
src/main/webapp/templates
An introduction and some background information to this quickstart can be found in the following chapters of GateIn Portal Developer Guide:
All you need to build this example project is Java 6.0 (Java SDK 1.6) or newer and Maven 3.0 or newer.
The project is designed to be deployed on GateIn Portal 3.6 running on JBoss AS.
You do not need to touch your settings.xml because of this quickstart. All necessary artifacts are available in public repositories.
The following shows the command line to start the server with the web profile:
For Linux: JBOSS_HOME/bin/standalone.sh
For Windows: JBOSS_HOME\bin\standalone.bat
Type this command to build and deploy the archive:
mvn clean package jboss-as:deploy
To deploy to other than default localhost:9999 JBoss instance, copy the following configuration
just after <artifactId>jboss-as-maven-plugin</artifactId>
in the pom.xml file and adjust it to suit your needs.
username
and password
elements can be omitted sometimes, depending on your JBoss security settings.
<configuration>
<hostname>127.0.0.1</hostname>
<port>9999</port>
<username>admin</username>
<password>secret</password>
</configuration>
This will deploy target/cdi-jsf-portlet.war
to the running instance of the portal.
To ensure that the example portlet has been deployed successfully, do the following:
When you are finished testing, type this command to undeploy the archive:
mvn jboss-as:undeploy
You can also deploy the quickstarts from Eclipse using JBoss Tools. For more information on how to set up Maven and JBoss Tools, refer to the JBoss Enterprise Application Platform 6 Development Guide or Get Started Developing Applications.
If you want to debug the source code or look at the Javadocs of any library in the project, run either of the following commands to pull them into your local repository. The IDE should then detect them.
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
Please post feedback on this quickstart or GateIn Portal on GateIn Forums.