Java Reference
In-Depth Information
Figure 3-17. Dispatcher view class diagram
You have encountered most of the classes and interfaces before, except
UrlFilenameViewController . This is a concrete controller implementation and converts
the requested URL path into a logical view name. For example, a request for
/PolicyCreateHelp.do will be transformed to the view name PolicyCreateHelp . The
InternalResourceViewResolver then picks up this view name to resolve it to the actual
resource— PolicyCreateHelp.jsp . Using this controller is just a matter of configuration,
as shown in Listing 3-57.
As a first step to implementing this pattern, we create the PolicyCreateHelp.jsp file
in the /WEB-INF/jsp/help folder. It is not advisable to use static HTML files to serve the
help contents. This because in the future you may need to support internationalized
help. Besides, FreeMarker or Velocity templates can be used to keep the actual content
externalized separately from the JSP, making it easy to maintain and change. The final
step in using the dispatcher view is setting up the Spring configuration file, as shown
Listing 3-57.
Listing 3-57. insurance-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" http://www.springframework.org/schema/beans"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
>
 
Search WWH ::




Custom Search