JBoss Tools 3 Developer Guide
JBoss Tools consist of the best Java frameworks and technologies placed together under the same "roof." Discovering JBoss Tools is like exploring a cave; at first everything seems unknown and complicated, but once you become familiar with the main features of the tools, you will start to feel at home.
Throughout this article, you will follow the "learning by example" technique, and you will develop a completely functional JSF application that will represent a JSF registration form as you can see in Figure 1. These kinds of forms can be seen on many sites, so it will be very useful to know how to develop them with JSF Tools.
Click here for larger image
Figure 1: JSF Registration Form
The example consists of a simple JavaServer Pages (JSP) page, named register.jsp, containing a JSF form with four fields (these fields will be mapped into a managed bean), as follows:
- personName This is a text field for the user's name.
- personAge This is a text field for the user's age.
- personPhone This is a text field for the user's phone number.
- personBirthDate This is a text field for the user's birth date.
The information provided by the user will be properly converted and validated using JSF capabilities. Afterwards, the information will be displayed on a second JSP page, named success.jsp.
Overview of JSFJava Server Faces (JSF) is a popular framework used to develop user interfaces (UIs) for server-based applications (it is also known as JSR-127 and is a part of J2EE 1.5). It contains a set of UI components totally managed through JSF support, like handling events, validation, navigation rules, internationalization, accessibility, customizability, and so on. In addition, it contains a tag library for expressing UI components within a JSP page. The JSF features mentioned here are:
- A set of base UI components
- Extension of the base UI components to create additional UI component libraries
- Custom UI components
- Reusable UI components
- Read/write application date to and from UI components
- Managing UI state across server requests
- Wiring client-generated events to server-side application code
- Multiple rendering capabilities that enable JSF UI components to render themselves differently depending on the client type
- Tool friendly
- Implementation agnostic
- Abstracted away from HTTP, HTML, and JSP
Speaking of the JSF life cycle, you should know that every JSF request that renders a JSP involves a JSF component tree, also called a view. Each request is made up of phases. By default, JSF has the following phases (shown in Figure 2):
- The restore view is built.
- Request values are applied.
- Validations are processed.
- Model values are updated.
- The applications are invoked.
- A response is rendered.
- During the above phases, the events are notified to event listeners.
Click here for larger image
Figure 2: JSF Default Phases
We end this overview with a few bullets regarding JSF UI components:
- A UI component can be anything from a simple to a complex user interface (for example, from a simple text field to an entire page).
- A UI component can be associated to model data objects through value binding.
- A UI component can use helper objects, like converters and validators.
- A UI component can be rendered in different ways, based on invocation.
- A UI component can be invoked directly or from JSP pages using JSF tag libraries.
Page 1 of 5