Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
PrimeFaces Cookbook

You're reading from   PrimeFaces Cookbook Here are over 100 recipes for PrimeFaces, the ultimate JSF framework. It's a great practical introduction to leading-edge Java web development, taking you from the basics right through to writing custom components.

Arrow left icon
Product type Paperback
Published in Jan 2013
Publisher Packt
ISBN-13 9781849519281
Length 328 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Mert Caliskan Mert Caliskan
Author Profile Icon Mert Caliskan
Mert Caliskan
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

PrimeFaces Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with PrimeFaces FREE CHAPTER 2. Theming Concept 3. Enhanced Inputs and Selects 4. Grouping Content with Panels 5. Data Iteration Components 6. Endless Menu Variations 7. Working with Files and Images 8. Drag Me, Drop Me 9. Creating Charts and Maps 10. Miscellaneous, Advanced Use Cases Index

Preface

PrimeFaces Cookbook is the first PrimeFaces book that provides a head start to its readers by covering all the knowledge needed for working with the PrimeFaces components in the real world. It's a quick, practical guide to learn PrimeFaces—the rapidly evolving, leading JSF component suite. It is written in a clear, comprehensible style and addresses a wide audience interested in modern, trend-setting Java or JEE web development.

What this book covers

Chapter 1, Getting Started with PrimeFaces, provides details on the setup and configuration of PrimeFaces along with the basics of the PrimeFaces AJAX mechanism and the integration with other JSF component libraries. The goal of this chapter is to provide a sneak preview on some of the features of PrimeFaces, such as the AJAX processing mechanism and resource handling with internationalization and localization, along with the necessary steps to go through for implementing a simple web application powered by PrimeFaces, which will give a head start to the user.

Chapter 2, Theming Concept, introduces the PrimeFaces themes and the concepts involved. Readers will learn about the theming of PrimeFaces components. The difference between structural and skinning CSS, installing and customizing of PrimeFaces themes, along with creating new themes, will be detailed. Readers will also see how to adjust font family and font size throughout PrimeFaces components to provide a consistent look and feel. Discussion about two variants of the theme switcher—stateless versus stateful—finish this chapter.

Chapter 3, Enhanced Inputs and Selects, explains how to work with the input and select components available in PrimeFaces. Such components are the main parts of every web application. PrimeFaces provides nearly 25 components for data input, which extend standard corresponding JSF components with skinning capabilities and useful features such as user-friendly interfaces, AJAX interactions, and validation.

Chapter 4, Grouping Content with Panels, covers various container components such as Panel, Accordion, ScrollPanel, and TabView, which allow grouping of the JSF components. Various settings to configure panel components are detailed in this chapter.

Chapter 5, Data Iteration Components, covers the basic and advanced features to visualize data with data iteration components provided by PrimeFaces. Such data iteration components are, for instance, DataTable, Tree, and TreeTable. The discussed features include sorting, pagination, filtering, lazy loading, and single and multiple selections.

Chapter 6, Endless Menu Variations, explains about several menu variations. PrimeFaces' menus fulfill all major requirements. They come with various facets—static, dynamic, tiered, iPod-styled, and so on—and leave nothing to be desired. Readers will face a lot of recipes that discuss the menus' structure, configuration options, customizations, and integration with other components. At the end of this chapter, readers will know what kind of menu to choose and how to put it on a page for this or that use case.

Chapter 7, Working with Files and Images, provides ways of managing operations on files such as uploading and downloading, and image operations such as capturing, cropping, and comparing. Readers will learn basic as well as advanced configuration of components and use cases.

Chapter 8, Drag Me, Drop Me, explains how the drag-and-drop utilities in PrimeFaces allow you to create draggable and droppable user interfaces efficiently. They abstract developers from dealing with implementation details on the browser level. In this chapter, readers will learn about PrimeFaces' drag-and-drop utilities—Draggable and Droppable. AJAX-enhanced drag-and-drop and a special integration with data iteration components will be explained as well.

Chapter 9, Creating Charts and Maps, covers the ways to create visual charts with PrimeFaces' extensive charting features, and create maps based on Google Maps. PrimeFaces offers basic and advanced charting with its easy-to-use and user-friendly charting infrastructure. Throughout the chapter, mapping abilities such as drawing polylines, polygons, handling markers, and events are also covered.

Chapter 10, Miscellaneous, Advanced Use Cases, introduces more interesting features of the PrimeFaces library. You will learn about RequestContext—a helpful utility that allows marking components as updatable targets at runtime, adding AJAX callback parameters, and more. In this chapter, a number of real-world samples will also be developed—blocking UI during AJAX calls, periodic polling, focus handling, controlling form submission, and targetable messages, to name a few. Furthermore, after reading this chapter, readers will be aware of pitfalls of menus within layout units and nested panels.

Chapter 11, Writing Custom Components, explains the complete process of building reusable PrimeFaces components. First of all, readers will learn the component's structure and constituent parts. After that, a custom Layout component as an alternative implementation to the PrimeFaces one, will be developed. At the end of this chapter, readers will be equipped with necessary knowledge to be able to create different custom components for the next few JSF or web applications.

You can download this chapter from http://www.packtpub.com/sites/default/files/downloads/9281OS_Chapter_11_Writing_Custom_Components.

Chapter 12, PrimeFaces Extensions in Action, introduces PrimeFaces Extensions, a community-driven, open source project. The aim of this chapter is the presentation of some additional components, such as InputNumber, CodeMirror, DynaForm, and Timeline. This young project can spark interest in developing rich web applications.

You can download this chapter from http://www.packtpub.com/sites/default/files/downloads/9281OS_Chapter_12_PrimeFaces_Extensions_in_Action.

What you need for this book

PrimeFaces only requires Java 5+ runtime. With the help of the Maven tool, you can easily get the artifact for PrimeFaces library (for more information on installing Maven, visit http://maven.apache.org). Please note that Maven demands readers Java Development Kit is installed on your local environment instead of the Java Runtime Environment.

To get the Cookbook showcase up and running, you need to pull the source code with a Git client. The details on how to run the showcase web application in your local environment can be found on GitHub (https://github.com/ova2/primefaces-cookbook).

Who this book is for

This book is for everybody who would like to learn modern Java web development based on PrimeFaces and is looking for a quick introduction to this matter. Prerequisites for this book are basic JSF, jQuery, and CSS skills.

Conventions

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 are shown as follows: "For the first page, we also needed to provide the contentType parameter for f:view."

A block of code is set as follows:

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

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<p:contextMenu for="..." nodeType="...">
    <p:menuitem value="..." update="..."
        icon="..." oncomple="..."/>
</p:contextMenu>

Any command-line input or output is written as follows:

-rw-r--r--   1 primeuser staff    834 May 21 16:45 log.roo
-rw-r--r--   1 primeuser staff  17650 May 21 16:45 pom.xml
drwxr-xr-x   3 primeuser staff    102 May 21 16:45 src

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: "The add-on can be opened after its installation by navigating to Tools | Web Developer | Firebug."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

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 , and mention the book title via 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 .

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.

Customer support

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.

Downloading the example code

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.

Errata

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 on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

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 with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime