PrimeFaces is a leading lightweight open source user interface component library for JSF-based web applications. It provides a rich set of 100+ UI components with a single JAR, zero configuration, and no prerequisites. PrimeFaces aims to create built-in Ajax components that are based on standard JSF 2.0 Ajax APIs with a rich look and feel, with the help of a theming mechanism.
The initial development of PrimeFaces was started in 2008 by a Turkish JSF expert, Çağatay Çivici. Prior to developing PrimeFaces, he had been working on the YUI4JSF library. This experience of working with the YUI4JSF library allowed him to start developing PrimeFaces, which was initially based on the YUI JavaScript library. A few days later, the PrimeFaces team decided to replace this library with the powerful jQuery framework in order to create the component widgets.
This book will guide you through the process of creating a wide range of rich UI web applications based on successful, real-world business models. Each chapter comes with a custom web project, which you can build with a detailed, step-by-step procedure. This is accompanied by explanations of the key features used. By the end of each chapter, you will learn how to build specific, customized web applications using the PrimeFaces components. The projects inside this book make use of the latest versions of PrimeFaces (Version 5.0) and JSF (Version 2.2).
Chapter 1, Creating a "Hello World" Application, discusses how to create a simple "Hello World" PrimeFaces application in a step-by-step procedure and how to create the recommended PrimeFaces - supported environment (required software, browsers, IDE, tools, and so forth) that is required for real-world application development. A brief introduction to PrimeFaces and its role in UI applications will also be covered at the beginning of the chapter.
Chapter 2, Creating an Employee Registration Application, shows you how to create an employee registration application, which is an example of how to form components and their validations. The big set of PrimeFaces form components will be divided into two main categories, which are input components and select components, to create the registration type of the form filling application. These components and their validations that are used will also be explained in detail.
Chapter 3, Creating a Simple Restaurant Point of Sale Application, explains how to create a restaurant POS application with the help of the PrimeFaces layout and grouping components. These topics provide the templating mechanism needed for a fancy application, and each concept will be explained in detail.
Chapter 4, Global Mutual Funds Tracking, directs you on how to create a global mutual funds tracking application with the help of a data container and dialog components. This project emphasizes the usage of the data container and dialog components in order to maintain the big datasets in investment/financial schemes. The master-client and hierarchical data relationships (which are linked to these components) will also be well explained.
Chapter 5, Investor Information Analysis and Reporting, shows you how to create an investor information analysis application, which is useful because it is an example of data visualization and reporting components. Big datasets for reporting data will be analyzed in the form of charts and various formats of export features. The data visualization and reporting components used within this application will also be explained.
Chapter 6, Creating a Simple Online Shopping Cart Application, shows you how to create an online shopping cart application using the major menu variations and drag-and-drop components in PrimeFaces. This shopping cart application can be used to cover various products, such as electrical goods or household products.
Chapter 7, Creating an Online Video Portal Application, directs you on how to create an online movie portal application, which makes use of PrimeFaces multimedia, maps, and schedule components. This application can be used in the entertainment world and to book events that vary seasonally, such as special events in the summer or winter. Customers can pick the events that interest them and book them accordingly.
Chapter 8, Creating an Online Printing Station Application, guides you through how to build an online printing station application. This application handles all types of files using the PrimeFaces file upload and download components. This application will showcase a new concept that provides a platform to track, submit, and process printing jobs from multiple users across different locations.
Chapter 9, Creating an Online Chat Application, shows you how to create an online chat room application using the PrimePUSH. The PrimePUSH API deals with the asynchronous communication between the server and client using this chat room application. This chapter uses the simple social network application as our sample project.
Chapter 10, Creating a Healthcare Products Application, shows you how to create an online healthcare products application using common utility components and theming concepts (such as using built-in themes, customizing these, and creating new ones).
As a reader of this book, you will need Java 5 or above and Maven installed on your machine, along with the JSF and PrimeFaces libraries. Optionally, you can use software and tools such as the Eclipse IDE, MySQL DB, and any browser tools to debug the application. You should also have a basic knowledge of JSF, PrimeFaces, and jQuery.
In order to run the customized web projects in this book, you need to store them on GitHub. This means that you can pull the source code at any time in order to have an efficient practical experience.
The software libraries or tools used in all of the customized projects of this book are listed as follows:
JDK 1.5+ from Oracle's official site. You can download this at http://www.oracle.com/technetwork/java/javase/downloads/index.html.
The Mojarra Java Server Faces implementation's latest version. This can be downloaded at https://javaserverfaces.java.net/download.html.
The latest version of PrimeFaces from the PrimeFaces official site, which can be downloaded at http://www.PrimeFaces.org/downloads.html.
The latest version of PrimeFaces Extensions, which can be downloaded at http://PrimeFaces-extensions.github.io/.
MySQL from its official site (http://www.mysql.com/), or any other relational database based on the JDBC driver.
Eclipse from the official site (http://www.eclipse.org), or any other Java IDE.
The Apache Maven build tool from the official site (http://maven.apache.org/) to work with customized projects.
PrimeFaces components result in a rich UI application with lots of CSS, JS, and HTML markup resources; it would be very helpful to use browser tools such as the Firebug plugin for Firefox, FirebugLite for the Chrome browser, Developer Tools (F12) for Internet Explorer, and Developers Tools (which you can access using Ctrl + Shift + I) for the Chrome browser.
To work with the Blueprint projects, you need to check out the source code using a Git client or using IDE Git repositories. The step-by-step instructions to run the customized web projects are covered in GitHub (https://github.com/sudheerj/PrimeFaces-blueprints).
This book is for anyone who wants to learn how to create customized PrimeFaces web applications. If you want to create a different set of categories for customized applications using PrimeFaces components, then this book is for you.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "These managed beans interact between XHTML/Facelets and the POJO
class with the @ManagedBean
annotation."
A block of code is set as follows:
<div id="header"> <ui:insert name="header"> <ui:includesrc="/templates/common/header.xhtml" /> </ui:insert> </div>
Any command-line input or output is written as follows:
mvn clean package
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Select the PrimeFaces component suite from the Components tab."
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title through the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>
.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.