primefaces

Getting started with primefaces

Remarks#

PrimeFaces is an open source JSF framework. Its main features:

  • 100+ components.
  • Built-in Ajax based on standard JSF Ajax APIs.
  • Push support via Atmosphere Framework.
  • Mobile UI kit to create mobile web applications.
  • 35+ built-in themes.
  • Premium themes and layouts.

Versions#

VersionRelease Date
0.8.12009-02-23
0.8.22009-03-26
0.8.32009-04-23
0.9.02009-06-15
0.9.12009-08-04
0.9.22009-09-07
0.9.32009-10-05
1.0.0 and 2.0.02010-02-15
1.0.1 and 2.0.12010-04-19
1.0.2 and 2.0.22010-05-31
1.1 and 2.12010-07-26
2.22011-02-07
3.02012-01-04
3.12012-02-06
3.22012-03-12
3.32012-05-29
3.42012-09-03
3.52013-02-04
4.02013-10-03
5.02014-05-05
5.12014-10-06
5.22015-04-08
5.32015-10-19
6.02016-06-07

Installing PrimeFaces

PrimeFaces can be used in all web applications based on Java Server Faces (version 2.x) which are run on Servlet Containers (e.g. Wildlfy or Tomcat or GlassFish).

There are several ways you can add PrimeFaces to your application.

Manually

Download the primefaces-{version}.jar and add it to you classpath.

Maven

<dependency>  
    <groupId>org.primefaces</groupId>  
    <artifactId>primefaces</artifactId>  
    <version>{version}</version>  
</dependency>

For older versions (3.5 and below) you additionally have to add the PrimeFaces repository:

<repository>  
    <id>prime-repo</id>  
    <name>PrimeFaces Maven Repository</name>  
    <url>https://repository.primefaces.org</url>  
    <layout>default</layout>  
</repository>

Gradle

repositories {
    mavenCentral()
        maven {
            url "https://repository.primefaces.org"
        }
}

dependencies {
    compile "org.primefaces:primefaces:{version}"
}

NetBeans

PrimeFaces is bundled with the Java EE bundle of NetBeans. When you create a new “Java Web -> Web Application” you can select JavaServer Faces as framework. Then you configure JSF to use PrimeFaces components. It will copy the library to your project.

If you have created a Maven web application, you can select project properties and select JavaServer Faces as framework and then select PrimeFaces as mentioned above. Your pom.xml will be modified to include the PrimeFaces dependency.

Hello world

After adding PrimeFaces to your JSF project, you can start using it in your pages using the namespace:

xmlns:p="https://primefaces.org/ui"  

or, for PrimeFaces Mobile:

xmlns:p="https://primefaces.org/mobile"  

This example should render a spinner:

<html xmlns="https://www.w3.org/1999/xhtml"  
      xmlns:h="https://java.sun.com/jsf/html"  
      xmlns:f="https://java.sun.com/jsf/core"  
      xmlns:p="https://primefaces.org/ui">
    <h:head>  
    </h:head>      
    <h:body>
        <p:spinner />
    </h:body>
</html>  

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow