Spring-Spring MVC4 Comments

All MVC frameworks for web applications provide a way to address views. Spring provides view resolvers, which enable you to render models in a browser without tying you to a specific view technology. Out of the box, Spring enables you to use JSPs, Velocity templates and XSLT views, I will write another tutorial of how to integrate and use a number of disparate view technologies.

The two interfaces that are important to the way Spring handles views are ViewResolver and View. The ViewResolver provides a mapping between view names and actual views. The View interface addresses the preparation of the request and hands the request over to one of the view technologies.

Spring comes with quite a few view resolvers :

  1. InternalResourceViewResolver example
    Adding a predefined prefix and suffix to the view name (prefix + view name + suffix), and generate the final view page URL.
  2. XmlViewResolver example
    Puts view beans in XML file.
  3. ResourceBundleViewResolver example
    Puts view beans in “.properties” file.
  4. Configure multiple view resolvers priority
    If multiple view resolver strategies are applied, you have to declare priority to avoid conflict issue.

See above links for more detail in each ViewResolvers and if you have any questions, feel free to ask me 🙂


4 Comments on this article

Add a comment


Warning: stream_socket_client(): unable to connect to http://browscap.org/version (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in /home/javasail/public_html/wp-content/plugins/wp-statistics/vendor/browscap/browscap-php/src/phpbrowscap/Browscap.php on line 1366

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /home/javasail/public_html/wp-content/plugins/wp-statistics/vendor/browscap/browscap-php/src/phpbrowscap/Browscap.php on line 876