Mapping JSF Technology with Other Web Tier Technologies
If we look at the new technologies introduced in Java domain, it can be clearly seen that web tier is one of the prime focus area now a days. Evolution of Java web technology had been slow as compared to the middle tier and persistent data access technology for past few years. For ages, we have been building presentation tier of our application around the jsp technology, with minor variation in the way we are constructing a jsp page. Though web tier is face of any application, and it has to be really good for the success of application, poor (business) users are managing work with the old technology resulting in dull GUI. Finally, it has drawn attention of Java technology pioneers and they have introduced two fundamentally different technologies in web tier. First is Java server faces (JSF) and second JavaFX. Though JSF is still based on jsp, it brings major change to the processing of jsp. JavaFX gives rich UI feature to the Java applications.
In this article, we are going to map Jsf with other existing technologies. I am assuming you know basics of web tier i.e. Jsp, servlet, custom tags or may be other web tier frameworks like Struts, Spring MVC etc.
Comparison with Other Web Tier Technologies:
Instead of giving list of code components that a JSF application needs, let us compare it with the options we had prior to JSF. This will make life easy for those people who already know at least one web tier technology. They will have to just call the components with different name.
| Technology | Presentation | Data Transfer | Servlet | Add-ons |
| Simple Jsp and Servlet | JSP with Java script | Through request object | Functional Servlet controlling navigation and managing data from request | Sun’s standard tag library |
| Struts | Jsp | ActionForm | Struts ActionServlet and application specific Action classes | Struts tag library |
| Spring MVC | Jsp | Command object | Spring MVC DispatcherServlet and application specific Controllers | Spring tag library |
| JSF | Jsp | Backing Beans (POJOS) | FacesServlet and application specific event listeners | Built in Components, tag lib and html renderer |
Above table will give us a clear idea of JSF components involved in any Jsf application, also you can map them with other technologies. Though the elements of JSF map exactly with other technologies, jsf is very different because of its difference in execution of a request.
In Jsf, we have following important components to be considered at (either written by developer or understood by developer)
Components to be Written by a Developer:
- Jsp
- Backing beans
- Configuration xmls (faces-config.xml)
- Event/Action handlers (action and action listener mappings)
Components Readily Available:
- Ready components through custom tags
- Ready validations to configure and use
- Custom tags for support
- HTML renderer
Similarity:
If we compare Jsf with other web frameworks, the common things are jsp, POJOs used to transfer data between client and server, configurable navigation, request data population in beans.
Difference:
Difference is in the processing of request. All other frameworks, traverse through the submitted page, retrieve information and set it in the POJO. Now, the submitted page details are lost, and what exists is a POJO. Jsf does not throw the view, which is a tree of components of jsp (form, text field, buttons, etc.). It stores the view and goes on enriching the view components as the request is processed through different life cycle stages.
Second important difference is the use of renderer. To present a evaluated view to client, Jsf needs a presenter. Example is HTML renderer, it converts the view components to html form and presents those.
Conclusion:
Though the components which constitute Jsf are almost same as other existing web frameworks, there is considerable difference in the execution of request.
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.
