Java Server Faces – First Take

Recently I’ve been indulging my senses in the world of Java and how it plays with the web application.

In short a very good idea fell by the way side due to the time consuming set up, development time, and overarching learning curve one has to go through to get the basics down.

As a test case I created an application which implemented basic database functions (C.R.U.D.). The application was initially written in PHP to compare JSF to.

In roughly 2 days the PHP application was fully implemented using Smarty and PHP, had the MVC architecture around it, and was fully tested and ready for the “prime time”.

Onto the JSF version…

To my suprise the headaches began immediatly. For startes the sample application I used, a very simple “hello world” could not be started up correctly on both Tomcat and JBoss. Both server environments didnt have much in displaying error s as to what could be the issue, so I was left searching the web most of the time for a solution. Thank god for the Java community. Keep in mind that this was just me setting up the JSF environment and not actually starting to develop the CRUD application.

A weekend later….Jboss and Tomcat configured to run the “hello world application”.

Onto the CRUD application. I started to create the “Backing Bean”, create Event handlers, and set up the faces-config file. This went well. Then came the implementation of a multi select checkbox module.

The goal was to allow the user to select ‘N’ number of checkboxes on the side of the record they wanted to edit but this proved to be a HUGE undertaking. JSF does no allow user defined values in their tag so the process was extremely drawn out. [Please read my article “JSF and Multi-Selection” ]

After figuring out the JSf tags I thought, “So whats so bad with HTML, XHTML, or JSTL”? Do we really need another rendering tag library?

This is when I realized. JSF makes web development tidious and extremely painful. Some may argue that JSF places a foundation around a application or that, “once you get the hang of things it goes faster”. These argument still do not excuse JSF from being fundamentally a bad web building tool.

All in all JSF is not all bad. For whats its worth I really enjoyed the faces-config file. Its a great way to create a site map of the application and its a fantastic way of displaying the structure of the application to the newly initiated on a project.

Unfortuantly for a simple CRUD application I dont see how JSF can perform efficiently with the likes of PHP/Smarty and RoR. Yes I know one is a template framework and the others are left up to the developer to architect a solution. Either way JSF should be easier.

Armando Padilla