Late last year, a Tennessee-based software development company, located in Nashville, was approached by a major client in the home improvement industry interested in simplifying the selling process for their retail employees. The client needed a system up and running quickly, and with over 1,000 stores averaging ten sales associates each, it had to be stable, scalable and responsive. Based on the business requirements and time estimates, Senior Software Engineer and Presentation Lead Ray Daniel and his co-workers realized that they would encounter some of the same issues that one of their Struts-based projects had faced. This time, however, they had the luxury of evaluating other web application frameworks that would reduce both development and maintenance costs.
"I approached the project manager about the possibility of using JavaServer Faces [JSF] for our presentation layer. I explained that I just finished porting a Struts applications to JSF and found it much easier to use and code against, that it promotes a cleaner separation of concerns with the other layers of an application, removes the need to riddle a JSP with scriplets, and reduces the number of lines of code needed on a JSP through the effective design and use of the JSF tag libraries," says Daniel.
Daniel put his words to action. He claimed that he could develop a full-fledged prototype using JSF with JSPs, business logic, and mock data, within a single week. To sweeten the deal, he offered to take the entire team out for ice cream if he couldn't deliver. Unfortunately, he was "a little too optimistic and failed to implement two of the pages in time. (I had to solve the requirement of using a radio button as a selection in a data table, which I posted my solution to, on the Sun forums and the jsf-developers yahoo group.) However, this was enough to convince the rest of management to consider adopting JSF as a valid solution for all of our current and future projects."
Within a month, the company had begun developing a full-featured e-commerce application with a shopping cart for their client. The system allowed for purchase of appliances, had the ability to compare different brands, calculated installation or removal costs, labor costs, delivery fees, and provided a host of other key features. It was ready for QA in mid-May, a mere two months after development began.
The application was designed on-site by a team of seven developers using UML diagrams, flow charts, and functionality documentation in November of 2004. The development of the presentation, application, and persistence layers was performed offshore by a team of eight. JSF pages were developed from user interface mock-ups built with Dreamweaver (the actual Dreamweaver-generated HTML was not used).
"In most cases, we end up calling the customer's API to get an XML
result" says Daniel. "They designed their own database using WebSphere [Studio]. We parse this data and build various value objects out of it. So, we can easily modify our commands to call another database and build the expected value objects. The application and presentation layers never know the difference, so we have the flexibility to sell a similar application to another customer."
The team chose v1.1 of Sun's JSF reference implementation (RI) after evaluating the Apache MyFaces implementation. Daniel states that "nothing in our UI layouts really forced us to go outside the standard components. However, we may adopt and convert to MyFaces since our development team uses many of the other Apache projects."
One of the elements missing from the RI, however, was a component for scrolling through multiple pages in an HtmlDataTable. Consequently, the team modified the Pager component found in Core JavaServer Faces to provide this functionality. In the future, they may add a bread crumb component, much like the menu component from JavaServer Faces in Action, if one isn't developed in the meantime by another vendor.
Although development has gone smoothly and rapidly, Daniel ran into a problem using the HtmlSelectOneRadio component inside of an HtmlDataTable to act as the selected row. He eventually derived a solution from some examples in the jsf-developer Yahoo Groups! Forum. He then, contributed his solution back to the jsf-developer forum as well as Sun's JSF forum.
The team's development platform consisted of Microsoft Windows XP machines using Genuitec MyEclipse, which provided basic support for JSF projects. Other tools included MagicDraw UML and Microsoft Visio for flow charts. Other than JSF, the application used Airlift, an open-source framework built on top of Hibernate and EJB.
Daniel and his team tested against Tomcat 4 and IBM WebSphere on both Windows XP and Linux (both Red Hat and SuSE). The customer's environment was based on Linux and WebSphere 5.1.
The application's initial QA date was May 15th, but the client was so pleased that the release date was pushed back and the development team was requested to add additional features and enhancements. This extended the project by about three months, so that the client could make changes to their APIs. With the slick new JSF application, the home improvement company expects to generate between $4 and $5 million in daily transactions.
In addition to the e-commerce application, the software developer is in the process of building two other enterprise JSF applications. One is an administration tool for dynamically displaying web content, and the other is a web front-end for a custom question and answer rules engine.
Daniel says that his company is pleased with the choice of JSF for its current and future web projects. "JSF has allowed us to cut our development time and costs, meet our tight deadlines, and it has provided the flexibility to add new features, enhancements, and overall changes during the development cycle. We are confident that this will hold true as new features are asked for in our applications", he declares.