Book Image

Primefaces Cookbook Second Edition

Book Image

Primefaces Cookbook Second Edition

Overview of this book

Table of Contents (20 chapters)
PrimeFaces Cookbook Second Edition
Credits
Foreword
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Integrating Font Awesome with PrimeFaces


The jQuery ThemeRoller provides various icons and corresponding style classes, but the number of icons is limited. If you need more icons, check out the Font Awesome project. (http://fortawesome.github.io/Font-Awesome). Font Awesome gives you hundreds of scalable vector icons that can be customized—size, color, drop shadow, and anything that can be done with the power of CSS. With a little effort, you are able to use many new icons in your JSF application in the same way that you use predefined icons from ThemeRoller.

In this recipe, we will learn step- by- step how to integrate additional icons from Font Awesome with PrimeFaces themes. We will develop an example with custom icons for buttons and links.

How to do it…

First of all, we need two dependencies in the pom.xml (two JAR files in the classpath)—one for the premade Font Awesome JAR created by the WebJars project (http://webjars.org) and one for the OmniFaces (http://omnifaces.org):

<dependency...