Java Reference
In-Depth Information
5. The resolveViewName method tries to map a given logical view name to a concrete
view resource. For this it seeks the help of all the registered ViewResolver classes in
the application context.
6. When the appropriate view object is resolved, the render method is invoked on it
to display the model data.
Using View Handlers
In the next section, I will show some of the commonly used concrete view resolvers in
action.
ResourceBundleViewResolver
This view resolver implementation has two advantages:
• It allows the logical view name to physical resource mapping to be configured in
externalized properties or resource bundle files.
• It adds internationalization support to the view resolution process. If we want to
configure a separate set of physical resources for different locales, this class makes
that possible.
eInsure had to be rolled out at a leading insurance company that had businesses in
Canada and Australia. Hence, eInsure had to support localized views: English in Australia
and French in Canada. One solution was to develop two sets of JSPs for presentation,
supporting different locales, and let ResourceBundleViewResolver find the appropriate
view at runtime. To achieve this solution, the eInsure team created two JSPs:
PolicyDetails_en_AU.jsp and PolicyDetails_fr_CA.jsp (Listing 3-9). The first JSP sup-
ported the Australian users, while the second catered to the French users in Canada.
Listing 3-9. PolicyDetails_fr_CA.jsp
<html>
<head>
<title>Underwriting</title>
<script>
function eventSubmit(url){
document.policy.action = url;
document.policy.submit();
 
Search WWH ::




Custom Search