PrimeFaces Configuration
Download JAR
To configure primefaces in our JSF application, we need to download only one JAR file primefaces-{version}.jar. We can manually download it from the official site of primfaces.
If we want to use it in maven project, we can add the following dependency in our pom.xml file.
Note: In NetBeans IDE, primefaces is included by default. We don’t need to download it manually.
Prerequisites
Mandatory dependencies: These are required to execute application.
Java – Java 6 or higher
JSF – JSF 2.0 or higher
Optional dependencies: These are not required but may be used to get custom features.
Dependency | Description |
---|---|
commons-fileupload, commons-io | It is used to upload files. |
atmosphere | It is used for Push support. |
barcode4j-light | It is used for barcode. |
itext | It is used to export PDF document. |
After adding dependencies, let’s create an application. This example includes the following steps.
Create a project
Provide project name.
Select server and J2EE version.
Select framework JSF and primeface Library.
Click on the finish, it will create a web application. The project structure looks like this:
This project contains default index.xhtml file. After running this index file, it produces the following output.
This page is redirect to welcomePrimefaces.xhtml that produces output like this: