Posted by: lrrp | December 18, 2007

Beyond Struts – The Way Forward

An Introduction to JSF Technology
Java Server Faces or JSF for short is another new exciting technology for developing web applications based on Java technologies. This is the complete guide to understand JSF, work flow of JSF, benefits of JSF over existing frameworks. It is natural to think about learning and adopting new framework while there exists some established and popular frameworks in present web development landscape. This article contains all you need to know about this new emerging and robust technology of JAVA.

It is the best combination of existing frameworks as it has been developed by taking best features from all and leaving and removing the rest bad. You can think about this fact that it has been developed by JCP (Java Community Process) of web application experts from different groups like Jakarta Struts, Oracle, Sun, IBM, ATG etc. They all collectively worked together to take the best from existing technologies and removed problems. So their collective effort brought a new technology named Java Server Faces (JSF).

Why JSF?
Let’s first understand the reasons that initiated the JSF project and why JSF is so hot these days. There are reasons for development of new framework in-spite of many already existing technologies like JSP, Servlets, Struts etc… If you have developed complex web based applications in jsp then you must be knowing the problem faced with those technologies. Here are the list of some of the problems faced with the previous technologies like JSP and Servlets:

* Tedious and repetitive coding
Previous technologies like JSP make programmer to do a lot of tedious and repetitive coding.

* Directly working with HTTP request and response
Using these technologies programmers directly work with HTTP request and response objects and manipulates the data. For example if user submits the registration form then programmer writes the code to get the values of each element in the form into a variable for further processing. When there is a need to retrieve the data from database and then show on the form for editing, then in this case programmer writes the code to retrieve the code from database and then set the values in the forms.

* Non availability of IDE
Non availability of IDE is another major drawback which affects the programmers productivity and development cost of the projects increases.

JSF changes all that by giving intuitive framework to the developers. Furthermore, JSP is specification and many vendors are developing their own implementations. Both free and commercial implementations of JSF are available these days. You can choose any one of them based on your requirement and budget.

Now a days software vendors are developing IDE for developing JSF based applications which is another good news for the learners of JSF framework. Once you are familiar with the core concepts of the JSF you can kick start the development of software projects using any IDE available in the market. These changes in the programming world makes the life of programmer much easier.

Java Server Faces is a component oriented and event driven framework for web applications. JSF eases the development of GUI for web applications. JSF allows the programmers to work with extensible user interfaces like buttons, text boxes, check boxes etc… Programmer writes the code for particular event such as button clicked. This makes programming much easier and now the there is no need to write request and response processing logic.

The quick Overview of JSF Technology
This section gives you an overview of Java Server Faces technology, which simplifies the development of Java Based web applications. In this JSF overview section you will learn how JSF fits into the web application development landscape.

JSF was developed by Java Community Process(JCP). This is a community of web application experts. These experts are from different groups like Jakarta Struts, Oracle, Sun, IBM, ATG etc. They all collectively worked together to take the best from existing technologies and removed problems. So their collective effort brought a new technology named Java Server Faces (JSF).

Java Server Faces or JSF for short, is the standard framework to simplify the process of developing web application in java. It is a robust component framework, event driven programming model. It offers a set of UI components, extensible architecture, supports multiple client devices etc. Extensible means additional functionality can be given on the top of JSF core i.e. we can customize the functionality. JSF is vendor independent technology that is a standard to be supported by whole software industry.

One of the main feature of JSF is that it has not only been designed for coding experts but for others also like :

1. Page authors
Web designers have experience with graphic design. They can design look and feel of web application in html/jsp using custom tag libraries of JSF.

2. Application developers
Application developers can integrate this design with UI components. They program objects, event handles, converters, validators.

3. Component writers
Component developer can build custom UI components because of JSF’s extensible and customizable nature. They can create their own components directly from UI component classes or extending the standard components of JSF.

4. Application architects

Application architects are responsible for designing web applications. Defining page navigation, ensuring Scalability of application, configuring beans object registration are the key points that an application architect handles.

5. Tool vendors

JSF is well suited for tool vendors, for example Sun Java Studio Creator application development tool, who provide tools that take advantages of JSF to create UI easier.

In the past many web development frameworks came in to existence founded on servlet and jsp. Struts emerged as a standard web application framework. It became framework of choice because it came early in the market and provided necessary features at the time but competitors continued providing additional features that struts lacks. So it became necessary for java to advent new standard framework with a powerful component model. This was the reason for developing JSF technology. So main purpose of developing JSF was to create a collection of APIs for the UI components with the capacity to manage their states, handle events and validation.

Struts has an option to migrate to JSF. The simplest option is to use JSF components and rest as usual. This will enable them to take advantage of third party JSF components. Main feature of JSF is ease of use. Developing web applications is easier and faster than other frameworks like struts because JSF supports UI components and easy event handling. Taking advantages of third party components can reduce the cost of rewriting existing elements, minimize the time of development.

What is JSF?
JSF is complex system but you will be highly benefited by JSF technology. For example, you can easily make rich graphical Web application that can’t be easily developed in HTML.

JSF is new standard framework, developed through Java Community Process (JCP), that makes it easy to build user interfaces for java web applications by assembling reusable components in a page. You can think of JSF framework as a toolbox that is full of ready to use components where you can quickly and easily add and reuse these components many times in a page and capture events generated by actions on these components. So JSF applications are event driven. You typically embed components in a jsp page using custom tags defined by JSF technology and use the framework to handle navigation from one page to another. Components can be nested within another component , for example, input box, button in a form.

JSF eases the development of web applications based on Java technologies. Here are some of benefits of using JSF:

JSF provides standard, reusable components for creating user interfaces for web applications.

JSF provides many tag libraries for accessing and manipulating the components.

It automatically saves the form data and repopulates the form when it is displayed at client side.

JSF encapsulates the event handling and component rendering logic from programmers, programmers just use the custom components.

JSF is a specification and vendors can develop the implementations for JSF.

There are many GUIs available these days to simplify the development of web based application based on JSF framework.

JSF Components
JSF includes mainly:

1. Set of APIs to represent and manage state of components that helps server side validation, event handling, page navigation, data conversion etc.

2. JSP custom tag library to create UI components in a view page.

The UI (user interface) created using JSF technology runs on server and output is shown to the client. Goal of JSF is to create web applications faster and easier. Developers can focus on UI components, events handling, backing beans and their interactions rather than request, response and markup. JSF hides complexities to enable developers to focus on their own specific work.

JSF Features
JSF is a rich featured framework of JAVA technology. JSF provides a set of standard features that makes it a powerful and standard among the existing technologies available for the development of web application based on java technologies. Some of the features have been given below to justify the above statement.

1. JSF is standard web user interface framework for Java.
2. Built on top of Servlet API.
3. JSF is a component framework
4. UI components are stored on the server.
5. Easy use of third party components.
6. Event driven programming model.
7. Events generated by user are handled on the server.
8. Navigation handling.
9. Can automatically synchronize UI components .
10. JSF supports multiple client devices.
11. JSF has extensible architecture.
12. International language support.
13. Extensive tool support (Sun, Oracle , IBM etc.).
14. Rapid application development approach.

How JSF Fits For Web Applications?

JSF best suits in to the java web development environment because of reasons described below : JSF has many advantages over other existing frameworks that makes it a better choice for web application development. Some of the reasons are below:

Easy creation of UI:
It makes easier to create complex UI for an applicaton using jsf tags.Its APIs are layered directly on top of servlet APIs that enables us to use presentation technology other than JSP,creating your own custom components and rendering output for various client devices.

Capacity to handle complexities of UI management:
It handles cleanly the complexities of UI management like input validation, component-state management, page navigation, and event handling.

Clean separation between presentation and logic:
One of the greatest advantage of jsf is to clearly separate behaviour and presentation in an application. JSF is based on the Model View Controller (MVC) architecture.

Shorter development cycle:
This separation between logic and presentation enables a wide range of users( from web-page designers to component developers). It allows members of team to focus on their own work only , resulting in division of labour and shorter development cycle.

Standard Java framework:
JSF is a Java standard which is being developed through Java Community Process (JCP). Several prominent tool vendors are members of the group and are committed to provide easy to use, visual, and productive develop environments for JavaServer Faces.

An extensible architecture:
JSF architecture has been designed to be extensible.Extensible means additional functionality can be given on the top of JSF core i.e. we can customize the functionality. JSF UI components are customizable and reusable elements. You can extend standard components and create your own complex components like stylish calendar, menu bar etc.

Support for multiple client devices:
Component developers can extend the component classes to generate their own component tag libraries to support specific client. JSF flexible and extensible architecture allows developers to do so.

Flexible rendering model:
Renderer separates the functionality and view of the component. So we can create multiple renderers and give them different functionality to get different appearance of the same component for the same client or different .

International language support:
Java has excellent support for internationalization . It allows you to localize messages with user specific locale. A locale is a combination of a country, a language, and a variant code. JavaServer Faces adopts this property and let you specify which locale your application supports. So you can display you messages in different languages.

Robust tool support:
There are several standard tool vendors like Sun Java Studio Creator who provide robust tools that take advantages of JSF to create server side UI easily.

JSF Components
Components in JSF are elements like text box, button, table etc.. that are used to create UI of JSF Applications. These are objects that manage interaction with a user. You can create :

#Simple components, like text box, button and
#Compound components, like table, data grid.

A component containing many components inside it is called a compound component. Components help developers to create UIs by assembling a number of components , associating them with object properties and event handlers. Would u like to repeat the same code again & again and waste time if u want to create many tables in hundreds of pages in your web application? Not at all. Once you create a component, it’s simple to drop that component onto any JSP.

JSF allows you to create and use components of two types:

Standard UI Components
JSF contains its basic set of UI components like text fields, check boxes , list boxes, panel , label, radio button etc. These are called standard components. For example:

UIForm represents a user input form that is a container of other components. UICommand represents UI components like buttons, hyperlinks and menu items.
UIInput represents UI components like text input fields, numeric input fields.

Custom UI Components
Generally UI designers need some different , stylish components like fancy calendar, tabbed panes. These types of components are not standard JSF components. JSF provides this additional facility to let you create and use your own set of reusable components.These components are called custom components.

One of the greatest power of JSF is to support third party components .Third party components are custom components created by another vendor. Several components are available in the market ,some of them are commercial and some are open source . You can use these pre-built & enhanced components in UI of your web application .Suppose u need a stylish calendar , u have an option to take it from third party rather than creating it.This will help you save time & cost creating effective & robust UI and to concentrate on business logic part of web application.

If u want to create custom components then its necessary to either implement UIComponent interface or extend UIComponentBase class that provides default behavior of components. These may be responsible for its own display or the renderer is used for its display. These components are stored in component tree on the server and they maintain state in between client requests. These components are manipulated on the sever in java code.

So the final conclusion of using third party components is that a more attractive , robust and functional UI can be created in a short time period, at low cost and with minimum man power.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: