Book Image

Apache MyFaces 1.2 Web Application Development

Book Image

Apache MyFaces 1.2 Web Application Development

Overview of this book

Hypes and trends (such as Web 2.0) cause a change in the requirements for user interfaces every now and then. While a lot of frameworks are capable of meeting those changing requirements, it often means you as a developer need in-depth knowledge of web standards, such as XHTML and JavaScript. A framework like Apache MyFaces that hides all details of how the page is rendered at the client and at the same time offers a rich set of tools and building blocks could save you a lot of time, not only when you're building a brand new application but also when you're adapting an existing application to meet new user interface requirements.This book will teach you everything you need to know to build appealing web interfaces with Apache MyFaces and maintain your code in a pragmatic way. It describes all the steps that are involved in building a user interface with Apache MyFaces. This includes building templates and composition components with Facelets, using all sorts of specialized components from the Tomahawk, Trinidad, and Tobago component sets and adding validation with MyFaces Extensions Validator.The book uses a step-by-step approach and contains a lot of tips based on experience of the MyFaces libraries in real-world projects. Throughout the book an example scenario is used to work towards a fully functional application when the book is finished.This step-by-step guide will help you to build a fully functional and powerful application.
Table of Contents (22 chapters)
Apache MyFaces 1.2
Credits
About the Author
Acknowledgement
About the Reviewers
Preface
Trinidad Tags
Trinidad Text Keys
Default JSF Error Messages
ExtVal Default Error Messages

Introducing Apache MyFaces


Apache MyFaces started out back in 2002 as the first open source implementation of the JavaServer™ Faces (JSF) standard. In July 2004, the project became part of Apache as an Apache Incubator project. In February 2005, MyFaces was promoted to a top-level Apache project. By the time MyFaces was submitted as an Apache project, it was already more than just an implementation of the standard. As the set of components defined by the JSF standard is rather limited, MyFaces went beyond the standard by adding more components and extended versions of the standard components. In April 2006, the extended components were separated from the core JSF implementation. From that moment, the components are in a subproject called Tomahawk, and the core JSF implementation is in the Core project.

Over time, Apache MyFaces was further expanded by other subprojects. Some of them added even more extended components, while others focused on other extended functionalities such as persistence scopes and annotation-based validation. Support for the use of Facelets, instead of JSP, was also added. Chapter 3 focuses on how we can get the most out of MyFaces by using Facelets. In the remaining chapters, we will use Facelets as the view technology.

License, community, and support

Because it is a part of the Apache project, Apache MyFaces and all of its subprojects are available under the terms of the liberal Apache License, Version 2.0. Judging by the list of companies using MyFaces at the MyFaces wiki (http://wiki.apache.org/myfaces/Companies_Using_MyFaces), Apache MyFaces is widely used, worldwide.

The MyFaces project as a whole has an active community of developers all over the world. Many individuals, as well as a number of companies, contribute to the projects. As one of the co-founders of the MyFaces project, the Austrian consulting company, Irian Solutions GmbH, has a large number of employees contributing to the project. The multinational software giant, Oracle Corporation, also has a number of employees contributing mainly to the Trinidad subproject, which was started with a large donation from Oracle.

Good community support for MyFaces and all subprojects is available through the MyFaces user mailing list. Detailed information on this mailing list, as well as a subscription link, can be found at http://myfaces.apache.org/mail-lists.html. It is good manners to start the subject line of any message to the list with the name of the subproject in square brackets such as [Core] or [Tomahawk]. As with most mailing lists, it is worth searching the history to check if your question has been asked already. A good tool to search the mailing list archives is provided by MarkMail, a link to which is provided at the page mentioned earlier.

MyFaces and Sun JSF RI

A lot of application servers are using Sun Microsystems’ JSF Reference Implementation (Sun JSF RI) of the JSF standard, which is also known by its code name, Mojarra. In most cases, it is possible to replace the application server’s default JSF implementation with MyFaces; however, this is almost never necessary. As both the Sun JSF RI and MyFaces core implement the same standard, there should not be much difference between using one or the other. All subprojects of Apache MyFaces should work on both MyFaces Core and Mojarra/Sun JSF RI without any problems.

On the other hand, if your application server uses Sun JSF RI by default, switching to MyFaces might be worth considering, especially during the development stage, as MyFaces Core gives a lot more diagnostic and debug information in the server logs than Mojarra does.

Whatever you choose, it is always useful to know which JSF implementation you are running your application on. When you encounter a strange problem, which could be a bug, one of the first questions on the mailing list will probably be what implementation you are running. An easy way to determine which implementation you are using is to consult the server logs of your application server. During start up, the name and version of the JSF implementation will be written into the log file.