Java Reference
In-Depth Information
All these cases required no business logic invocation. Although all these are simple
scenarios, our application based on a JSP front controller was not able to handle the situ-
ation in a simple fashion. Different developers created these pages and merrily added
if-else blocks to handle their cases. The simplest approach would be to handle the
request for these static contents directly, bypassing the page controllers. But this breaks
the overall uniform application structure. Also, it might be useful to secure these
resources so that no unauthorized access (such as directly typing the URL in the browser
address bar) is allowed.
Forces
• The application has a lot of static views that require no business logic processing.
• The semistatic views are presented from cached data.
• The purely static and semistatic views need to be handled consistently as other
dynamic views.
Solution
Use a dispatcher view to handle the processing of a static or semistatic view.
Strategies with the Spring Framework
Dispatcher View is actually a best practice to combine the other presentation tier pat-
terns. It employs dispatchers to delegate to the view. In this case, the dispatcher is a
combination of a controller and view resolver.
There can be two variants of this pattern for static and semistatic views. The semista-
tic views use cached data and hence need view helper support. I will start with the pure
static resources. Figure 3-17 shows the static structure of the Dispatcher View pattern.
 
Search WWH ::




Custom Search