Java Reference
In-Depth Information
The monolithic eInsure controller was coded to use only JSP as the view technology.
Hence, it was inflexible, and supporting a new view suitable for mobile devices was very
difficult.
The new features discussed in the previous two paragraphs can be better managed
with a strategy of “divide and conquer.” This involves employing pluggable components
with the front controller that are specialized to handle specific tasks. Two such important
components are the following:
Action handler : The action handler locates and executes the appropriate page con-
troller. The page controllers decouple business logic invocation from the front
controller. So, the WebWork 2.0 page controllers can be used with the front con-
troller by implementing WebWork-specific action handler components.
View handler : The view handler finds a view, binds the model returned by the page
controller, and prepares the response for the client. The view handler uses logical
view names (explained in the next section), thus abstracting the actual view object
from the front controller. Using the view handler, it is easy to support multiple view
types (HTML, JSP, PDF, Microsoft Excel, and so on). So, the view handler compo-
nent can be extended to help roll out views for mobile devices.
These components are connected to the front controller via configuration. This
enables the front controller to act as a coordinator only. This, along with decoupled
action and view management, makes the front controller more robust, reusable, and
highly extensible.
Forces
• Remove action and view management functionality from the front controller.
• Deploy pluggable action and view handlers to provide support for different types
of page controllers and views.
• Improve the reusability, cohesion, and modularity of the application code.
• The front controller should be generic and as lightweight as possible.
• Promote test-driven development by making it possible to run unit tests outside
the web container.
 
Search WWH ::




Custom Search