Java Reference
In-Depth Information
View Helper
Problem
The application controller and page controllers combine with the gateway servlet to
solve three important concerns of request processing:
• Request interception
• Invoking business components from page controllers
• Resolving the next view to be displayed with the data returned from business layer
However, in all the earlier discussions, I have deliberately bypassed another critical
concern—view creation. The data returned by the page controllers, as a result of invoking
the business logic, have to be consumed by the view components to provide the final
dynamic response.
eInsure primarily used JSP as the view technology. The data returned by the business
components was set as request attributes. It was later retrieved, processed, and used in
the JSPs using scriptlets. In other words, the dynamic data was combined with the static
markup or template text in the JSPs using embedded programming logic. This littering of
scriptlets significantly reduced reuse and increased maintenance efforts.
Forces
• Remove the programming logic from the template-based views like JSP.
• Achieve a division of labor between Java developers and web page authors.
• Create reusable components that can be used to combine model data across views.
Solution
Use view helpers to adapt model data with the view components in the presentation
layer.
 
Search WWH ::




Custom Search