20.04.2013 Views

Practical RichFaces, Second Edition

Practical RichFaces, Second Edition

Practical RichFaces, Second Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 1 THE BASICS<br />

JSF Is Very Extendable<br />

The extensibility feature is probably most responsible for making JSF a popular tool for building web<br />

applications. From the beginning, JSF was designed to be extended. Through standards, JSF allows you<br />

to extend the framework with new features and more advanced functionality. You are getting new<br />

functionality, but you are doing it in a standard and accepted way. One area that benefits most from this<br />

is the rich UI component ecosystem, which includes <strong>RichFaces</strong>. This eco-system is not limited to UI<br />

components—custom converters, validators, view handlers, and other extensions are created as well.<br />

The Most Important JSF Features<br />

JSF offers a long list of features. However, since this is not a dedicated JSF book, we will briefly cover the<br />

three most important features: user interface components, events, and the new Ajax functionality in JSF<br />

2. If you feel you need to review your JSF skills, we recommend the following two books: Core JavaServer<br />

Faces, Third <strong>Edition</strong> by David Geary and Cay Horstmann (Prentice Hall, 2010) and JavaServer Faces 2.0,<br />

The Complete Reference by Ed Burns and Chris Schalk (McGraw-Hill, 2009).<br />

Tip Two really great places to start learning JSF are http://javaserverfaces.org and<br />

http://jsfcentral.com.<br />

User Interface Components<br />

UI components are the main feature of the JSF framework. JSF ships with about 30 ready-to-use user<br />

interface components. Usually referred to as standard components, they provide basic user interface<br />

widgets for input, output, commands (buttons and links), labels, and layout, as well as simple controls to<br />

display tabular data. A number of utility components such as loading styles, scripts, and HTML page<br />

sections (head, body) are available as well.<br />

All JSF web applications are built out of components. A JSF UI component is a server-side Java<br />

object capable of processing input, firing actions, and rendering content. Component hierarchy is what<br />

JSF deals with. And tags are used for building that component tree. A JSF component can be as simple as<br />

an input field or as sophisticated as a tabbed panel or tree. For example, the following tag represents an<br />

input component:<br />

<br />

This is an input component that is bound (connected) to some Java object. You would place this tag<br />

on a JSF page instead of directly writing HTML code. The component behind the tag knows how to<br />

generate all the necessary and correct HTML, CSS, and JavaScript. Tags represent the server-side UI<br />

components and are used to build the JSF component tree shown in Figure 1-4.<br />

Component Rendering<br />

The JSF framework separates a component from the way it is presented (encoding) and the way input is<br />

processed (decoding). The appearance of the component can be easily varied for the type of display<br />

device available (for example, a mobile phone). For this book, you’ll work only with the HTML rendering<br />

kit that JSF provides out of the box.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!