You might be wondering, "What does JavaServer Faces have to do with Jakarta Struts?" The truth is, quite a bit. First and foremost, Craig McClanahan has a hand in both. As mentioned several times already, he is the creator of Struts and still participates as its steward, but he is also one of the technical leads on the JavaServer Faces JSR-127, along with Ed Burns. However, the key similarity between JSF is that both attempt to solve the same problem. That is, they are both Java frameworks for building web-based applications, with one big exception JSF is an actual specification, along the lines of JDBC, JNDI, EJB and so forth. Like other Java specifications, Sun and the JSR committee provide a set of APIs that describe the contract between a client and a provider of the technology. With JSF, the actual implementation of the JSF specification is left to the vendor to implement.
In contrast to JSF, Struts is based on a proprietary framework and API. Actions and forms built for use within a Struts application must be modified (or even rewritten) when switching to a different framework. There's also only one provider of Struts:Apache and the Struts development community. With JSF, there will be multiple implementations.
JSF's goal is to provide a way to build UIs (buttons, checkboxes and other widgets) that are client-independent. It does this by utilizing a rendering kit that contains client-dependent parts of the UI. The rendering kit detects the client in use and renders the widgets appropriately. JSF also supports the ability to create custom widgets, much like Java Swing. In fact, you can build completely new rendering kits if there are none available for your client type.
18.1.1 Do We Really Need Another UI Framework?
An often asked and completely valid question is: "Do we really need a new UI framework?" In fact, many would argue that we have too many already! These questions do need to be asked, but one must keep an open mind when asking them. Contrary to how one group or another might try to market a framework (commercial or open source), no single framework can contain every feature that every application might demand; this holds true for all types of frameworks. The more important question is: "Does JSF bring anything new to the mix?"
18.1.2 The Big-Picture Benefits of JSF
JSF does include several features currently found in existing UI frameworks. However, along with these features, it also includes things that can't be obtained from a single framework. Let's spell out several niceties of JSF and why you might consider using it by itself or in conjunction with the Struts framework.
The goal of JSF is to provide reusable server components for creating user interfaces. As such, it provides the following benefits for Java developers:
These benefits alone make JSF as powerful, if not more so, than many of the UI frameworks available today. Add to that a standardization which guarantees that multiple vendors will provide implementations, and JSF starts to become a very attractive option.