Migrating a Struts Application to JSF
Struts 1.1 and JSF 1.0 are definitely not equivalent in terms of features, and they aren’t intended to be. Struts focuses on the Controller part of the MVC triage, with features like declarative navigation and validation, which are more sophisticated than what you find in JSF 1.0. JSF, on the other hand, focuses on the user interface, providing an event-driven component model similar to what’s commonly used for standalone GUI applications, while Struts is more or less ignorant about how the user interface is developed.
That said, there’s a lot of overlap between the two; converting a Struts application that doesn’t use the more advanced Struts features to a pure JSF application is an option to consider. To get a feel for what it takes to convert a Struts application to JSF, let’s look at a Struts application that I developed for my book JavaServer Pages (O’Reilly). It’s a simple billboard service, where employees can post messages related to different projects they are involved with. An employee can customize the application to show only messages about the projects she’s interested in. Figure 12-6 shows the three application screens.
This application uses application-controlled authentication with a custom login page. The main screen has a form where the user can select projects of interest and a list of ...