Table Of ContentJBoss RichFaces 3.3
Enhance your JSF web applications using powerful
AJAX components
Demetrio Filocamo
BIRMINGHAM - MUMBAI
JBoss RichFaces 3.3
Copyright © 2009 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2009
Production Reference: 1231009
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-847196-88-0
www.packtpub.com
Cover Image by Filippo ([email protected])
Credits
Author Editorial Team Leader
Demetrio Filocamo Gagandeep Singh
Reviewer
Project Team Leader
Allan Lykke Christensen
Lata Basantani
Acquisition Editor
Project Coordinator
Sarah Cullington
Srimoyee Ghoshal
Development Editor
Proofreader
Swapna V. Verlekar
Lynda Sliwoski
Technical Editor
Graphics
Charumathi Sankaran
Nilesh R. Mohite
Copy Editor
Production Coordinators
Sanchari Mukherjee
Adline Swetha Jesuthas
Indexers Dolly Dasilva
Rekha Nair
Cover Work
Monica Ajmera
Adline Swetha Jesuthas
About the Author
Demetrio Filocamo is a computer science engineer with more than 10 years of
experience with both Desktop and web applications development. He works as a
consultant in London and collaborates with some companies and universities in
Italy. Demetrio has been developing Enterprise Java Applications using open source
solutions for the last five years.
About the Reviewer
Allan Lykke Christensen is the vice-president of Danish ICT Management,
an international consulting firm with its focus on ICT in developing economies.
He is responsible for daily management of teams in Uganda, Bangladesh, and
Denmark. In his daily work, he is also responsible for project planning, initiating,
and overall implementation. He has been developing and implementing IT projects
for more than 10 years. His expertise covers a wide range—he has developed
workflow systems, information systems, e-learning tools, knowledge management
systems, and websites. He has worked as a team leader on several major European
Commission-financed ICT projects in various developing economies. He has
co-authored The Definitive Guide to Apache MyFaces and Facelets (Apress, 2008) and
made countless presentations and training sessions on programming-related topics
around the world.
To my grandfather Demetrio, my family and Maria Chiara.
Table of Contents
Preface 1
Chapter 1: What is RichFaces? 7
An overview of RichFaces 7
A bit of history 9
The Ajax framework 10
Ajax Action Components 12
Ajax Containers 12
Ajax placeholders 12
Ajax validators 13
RichFaces components overview 13
RichFaces skinnability overview 13
Summary 14
Chapter 2: Getting Ready 15
Creating a RichFaces JSF project the simple way 15
Seam-gen 16
Download and install seam-gen 16
Generating a project using seam-gen 16
Overview of the project structure 18
Incremental hot deployment 20
Seam and Facelets support 20
Adding RichFaces manually to your existing JSF project 21
Downloading RichFaces 21
Basic configuration 22
Where to put the libraries 22
Registering RichFaces 25
Facelets support 26
IDEs 27
Eclipse/JBoss Tools 27
Where to download and how to install it 28
Table of Contents
JBoss Developer Studio 29
Importing a seam-gen generated project into Eclipse 29
IntelliJ Idea 30
Where to download and how to install it 31
Summary 31
Chapter 3: First Steps 33
A simple contact manager 33
Creating the new project 34
Templating and Facelets 37
Modifying the created project 39
The model 41
The managed bean 42
Making it a managed bean 44
The "Insert new contact" form 45
The main box 46
The form fields 46
Ajax command buttons: a4j:commandButton 53
Ajax command links: a4j:commandLink 54
The contact list 54
Re-rendering the contact list after adding a new contact 56
Adding the delete button 56
Summary 57
Chapter 4: The Application 59
What we are going to develop? 59
Features 60
Groups manager 60
File uploads and notes 60
Simple search 60
User skin 60
Multilanguage 61
The database: E-R diagram 61
Importing the database 63
Creating the project 64
The class diagram 66
Some modification to the entities 68
Editing the template page 70
The menu page 71
The login page 73
The home page 75
Summary 76
[ ii ]
Description:This is a practical tutorial following the use of RichFaces in a sample application. It includes many examples of the creation and customization of different AJAX components. This book targets Java Developers who want to enhance their JSF applications by adding AJAX, but without having to use JavaSc