{"id":53297,"date":"2016-03-02T10:00:23","date_gmt":"2016-03-02T08:00:23","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=53297"},"modified":"2016-03-01T10:23:16","modified_gmt":"2016-03-01T08:23:16","slug":"configure-multiple-view-resolvers-spring","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html","title":{"rendered":"Configure multiple View Resolvers in Spring"},"content":{"rendered":"<h2>1. Introduction<\/h2>\n<p>In Spring, the View Resolver is provided to resolve the view with the data available in the model, without tightly binding to a\u00a0View technology, be it JSP, Velocity or Thymeleaf. Spring makes it easy and flexible to configure <strong>one or multiple\u00a0View Resolvers<\/strong>, as\u00a0per the need would be.<\/p>\n<h2>2. Spring MVC application flow<\/h2>\n<p>Before we proceed with understanding how <strong>multiple View Resolvers<\/strong>\u00a0serve the purpose, lets take a quick recap of the <a href=\"http:\/\/www.jcombat.com\/spring\/spring-mvc-application-flow\" target=\"_blank\">Spring MVC application flow<\/a>.<\/p>\n<ol>\n<li>Incoming request comes through <strong>web.xml<\/strong>, <strong>dispatcher servlet<\/strong> and hits the <strong>controller<\/strong>.<\/li>\n<li>Controller interacts with the application layers and prepares the <strong>model<\/strong>.<\/li>\n<li>Controller returns the <strong>ModelAndView<\/strong>, with model and the view name.<\/li>\n<li>The <strong>ViewResolver<\/strong> provides a mapping between view names and actual views.<\/li>\n<li>The <strong>View<\/strong> interface addresses the request of a view to respective View technology.<\/li>\n<li>The view is then rendered onto the browser along with the model data.<\/li>\n<\/ol>\n<h2>3. Implementation<\/h2>\n<p>Let\u2019s start with the pom dependencies.<\/p>\n<p><strong><em>pom.xml<\/em><\/strong><\/p>\n<pre class=\"brush:xml\">&lt;!-- Spring 3 dependencies --&gt;\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;spring-core&lt;\/artifactId&gt;\r\n\t&lt;version&gt;${spring.version}&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n \r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;spring-web&lt;\/artifactId&gt;\r\n\t&lt;version&gt;${spring.version}&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n \r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;spring-webmvc&lt;\/artifactId&gt;\r\n\t&lt;version&gt;${spring.version}&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n \r\n&lt;!-- Jackson JSON Mapper --&gt;\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.codehaus.jackson&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;jackson-mapper-asl&lt;\/artifactId&gt;\r\n\t&lt;version&gt;${jackson.version}&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n \r\n&lt;!-- JSTL Dependency --&gt;\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;jstl&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;jstl&lt;\/artifactId&gt;\r\n\t&lt;version&gt;${jstl.version}&lt;\/version&gt;\r\n&lt;\/dependency&gt;<\/pre>\n<p>Not much change in the web.xml.<\/p>\n<p><strong><em>web.xml<\/em><\/strong><\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"ISO-8859-1\"?&gt;\r\n&lt;web-app xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n\txmlns=\"http:\/\/java.sun.com\/xml\/ns\/javaee\"\r\n\txsi:schemaLocation=\"http:\/\/java.sun.com\/xml\/ns\/javaee\r\n\thttp:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_2_5.xsd\"\r\n\tid=\"WebApp_ID\" version=\"2.5\"&gt;\r\n \r\n\t&lt;display-name&gt;MultipleViewResolversExample&lt;\/display-name&gt;\r\n \r\n\t&lt;servlet&gt;\r\n\t\t&lt;servlet-name&gt;mvc-dispatcher&lt;\/servlet-name&gt;\r\n\t\t&lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;\/servlet-class&gt;\r\n\t\t&lt;load-on-startup&gt;1&lt;\/load-on-startup&gt;\r\n\t&lt;\/servlet&gt;\r\n \r\n\t&lt;servlet-mapping&gt;\r\n\t\t&lt;servlet-name&gt;mvc-dispatcher&lt;\/servlet-name&gt;\r\n\t\t&lt;url-pattern&gt;\/API\/*&lt;\/url-pattern&gt;\r\n\t&lt;\/servlet-mapping&gt;\r\n \r\n&lt;\/web-app&gt;<\/pre>\n<p>Here is the mvc-dispatcher-servlet, which has <strong>multiple View Resolvers defined<\/strong>.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><strong><em>mvc-dispatcher-servlet.xml<\/em><\/strong><\/p>\n<pre class=\"brush:xml;highlight:[11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]\">&lt;beans xmlns=\"http:\/\/www.springframework.org\/schema\/beans\"\r\n\txmlns:context=\"http:\/\/www.springframework.org\/schema\/context\"\r\n\txmlns:mvc=\"http:\/\/www.springframework.org\/schema\/mvc\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n\txsi:schemaLocation=\"http:\/\/www.springframework.org\/schema\/mvc http:\/\/www.springframework.org\/schema\/mvc\/spring-mvc.xsd\r\n\thttp:\/\/www.springframework.org\/schema\/beans http:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd http:\/\/www.springframework.org\/schema\/context \r\n        http:\/\/www.springframework.org\/schema\/context\/spring-context-3.0.xsd http:\/\/www.springframework.org\/schema\/mvc http:\/\/www.springframework.org\/schema\/mvc\/spring-mvc-3.0.xsd\"&gt;\r\n \r\n\t&lt;mvc:annotation-driven \/&gt;\r\n\t&lt;context:component-scan base-package=\"com.jcombat.controller\" \/&gt;\r\n \r\n\t&lt;!-- Bean View Resolver --&gt;\r\n\t&lt;bean class=\"org.springframework.web.servlet.view.BeanNameViewResolver\"&gt;\r\n\t\t&lt;property name=\"order\" value=\"0\" \/&gt;\r\n\t&lt;\/bean&gt;\r\n \r\n\t&lt;!-- JSP View Resolver --&gt;\r\n\t&lt;bean\r\n\t\tclass=\"org.springframework.web.servlet.view.InternalResourceViewResolver\"&gt;\r\n\t\t&lt;property name=\"prefix\"&gt;\r\n\t\t\t&lt;value&gt;\/WEB-INF\/&lt;\/value&gt;\r\n\t\t&lt;\/property&gt;\r\n\t\t&lt;property name=\"suffix\"&gt;\r\n\t\t\t&lt;value&gt;.jsp&lt;\/value&gt;\r\n\t\t&lt;\/property&gt;\r\n\t\t&lt;property name=\"order\" value=\"1\" \/&gt;\r\n\t&lt;\/bean&gt;\r\n \r\n\t&lt;bean name=\"jsonView\"\r\n\t\tclass=\"org.springframework.web.servlet.view.json.MappingJacksonJsonView\" \/&gt;\r\n \r\n&lt;\/beans&gt;<\/pre>\n<p>Note that the two View Resolvers configured are <strong>InternalResourceViewResolver<\/strong> and\u00a0<strong><a href=\"http:\/\/www.jcombat.com\/spring\/spring-mvc-beannameviewresolver-example\" target=\"_blank\">BeanNameViewResolver<\/a><\/strong>. We have\u00a0also set the priorities using the <strong>order<\/strong> property of the View Resolver. So\u00a0<strong>BeanNameViewResolver\u00a0<\/strong>has a higher priority. This means that when the <strong>ModelAndView<\/strong> object is returned, the\u00a0<strong>BeanNameViewResolver <\/strong>checks for the available bean views with the view name that is returned. If the matching bean view is found, it is rendered. If not, the next View Resolver i.e.\u00a0<strong>InternalResourceViewResolver<\/strong>, comes into the picture, and similarly\u00a0checks for the JSPs with the view name that is returned with\u00a0<strong>ModelAndView<\/strong>. If it is found, the view is rendered. But if not, and\u00a0there is no more View Resolvers down the hierarchy, an\u00a0appropriate exception is thrown.<\/p>\n<p>Moving ahead with the implemetation, we have the same Employee entity class, as we have been using recently.<\/p>\n<p><strong><em>Employee.java<\/em><\/strong><\/p>\n<pre class=\"brush:java\">package com.jcombat.bean;\r\n \r\npublic class Employee {\r\n\tprivate String empId;\r\n\tprivate String name;\r\n\t\r\n\tpublic String getEmpId() {\r\n\t\treturn empId;\r\n\t}\r\n\tpublic void setEmpId(String empId) {\r\n\t\tthis.empId = empId;\r\n\t}\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n}<\/pre>\n<p>Let\u2019s now write down the <strong>EmployeeController<\/strong>.<\/p>\n<p><em>EmployeeController.java<\/em><\/p>\n<pre class=\"brush:java;highlight:[23]\">package com.jcombat.controller;\r\n \r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.PathVariable;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\nimport org.springframework.web.servlet.ModelAndView;\r\n \r\nimport com.jcombat.bean.Employee;\r\n \r\n@Controller\r\n@RequestMapping(value = \"\/Employee\")\r\npublic class EmployeeController {\r\n \r\n\t@RequestMapping(value = \"\/{name}\/{empId}\", method = RequestMethod.GET)\r\n\tpublic ModelAndView process(\r\n\t\t\t@PathVariable(\"name\") String name,\r\n\t\t\t@PathVariable(\"empId\") String empId) {\r\n\t\tModelAndView modelAndView = new ModelAndView();\r\n\t\tEmployee employee = new Employee();\r\n\t\temployee.setEmpId(empId);\r\n\t\temployee.setName(name);\r\n\t\tmodelAndView.setViewName(\"employeeDetails\");\r\n\t\tmodelAndView.addObject(\"employee\", employee);\r\n\t\treturn modelAndView;\r\n\t}\r\n}<\/pre>\n<p>We now make sure the JSP with the view name \u2013 <strong>employeeDetails<\/strong>, exists.<\/p>\n<p><strong><em>employeeDetails.jsp<\/em><\/strong><\/p>\n<pre class=\"brush:java\">&lt;%@page contentType=\"text\/html\" pageEncoding=\"UTF-8\"%&gt;\r\n&lt;!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\"\r\n   \"http:\/\/www.w3.org\/TR\/html4\/loose.dtd\"&gt;\r\n&lt;html&gt;\r\n\t&lt;head&gt;\r\n\t\t&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=ISO-8859-1\"&gt;\r\n\t\t&lt;title&gt;Via JSP View Resolver&lt;\/title&gt;\r\n\t&lt;\/head&gt;\r\n\t&lt;body&gt;\r\n\t\t&lt;!-- Retrieve the model data through JSTL --&gt;\r\n\t\t&lt;p&gt;${employee.empId}&lt;\/p&gt;\r\n\t\t&lt;p&gt;${employee.name}&lt;\/p&gt;\r\n\t&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<h2>4. Running the application<\/h2>\n<p>When we\u00a0run the application, below is what we see.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/Snap1.png\" rel=\"attachment wp-att-53467\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-53467\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/Snap1.png\" alt=\"Snap1\" width=\"664\" height=\"163\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/Snap1.png 664w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/Snap1-300x74.png 300w\" sizes=\"(max-width: 664px) 100vw, 664px\" \/><\/a><\/p>\n<p>Note that we don\u2019t have any bean view with name <strong>employeeDetails<\/strong>,\u00a0but rather matches\u00a0with the actual JSP view file <strong>employeeDetails.jsp<\/strong>. Hence, the view gets resolved as JSP.<\/p>\n<p>Now let\u2019s return the view name as <strong>jsonView<\/strong>, modifying the below statement in the controller method.<\/p>\n<pre class=\"brush:java\">modelAndView.setViewName(\"jsonView\");<\/pre>\n<p><strong>BeanNameViewResolver<\/strong> being higher in priority, this time finds the bean view with the name <strong>jsonView<\/strong>, and instead of rendering the JSP view, the same URI now returns a <strong>JSON<\/strong>.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/Snap2.png\" rel=\"attachment wp-att-53469\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-53469\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/Snap2.png\" alt=\"Snap2\" width=\"669\" height=\"146\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/Snap2.png 669w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/Snap2-300x65.png 300w\" sizes=\"(max-width: 669px) 100vw, 669px\" \/><\/a><\/p>\n<h2>5. Download the source code<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.dropbox.com\/s\/ej5r6u6kneokx6m\/MultipleViewResolversExample.zip?dl=0\" target=\"_blank\">Download the source code<\/a><\/li>\n<\/ul>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/www.jcombat.com\/spring\/multiple-view-resolvers-in-spring\">Configure multiple View Resolvers in Spring<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/join-us\/jcg\/\">JCG partner<\/a> Abhimanyu Prasad at the <a href=\"http:\/\/www.jcombat.com\">jCombat<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction In Spring, the View Resolver is provided to resolve the view with the data available in the model, without tightly binding to a\u00a0View technology, be it JSP, Velocity or Thymeleaf. Spring makes it easy and flexible to configure one or multiple\u00a0View Resolvers, as\u00a0per the need would be. 2. Spring MVC application flow Before &hellip;<\/p>\n","protected":false},"author":958,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[30,150],"class_list":["post-53297","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-spring","tag-spring-mvc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Configure multiple View Resolvers in Spring - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Introduction In Spring, the View Resolver is provided to resolve the view with the data available in the model, without tightly binding to a\u00a0View\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Configure multiple View Resolvers in Spring - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Introduction In Spring, the View Resolver is provided to resolve the view with the data available in the model, without tightly binding to a\u00a0View\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/abhi435\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-02T08:00:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Abhimanyu Prasad\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abhimanyu Prasad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html\"},\"author\":{\"name\":\"Abhimanyu Prasad\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/8084cf3db3cc9b2c21fc2c04307d47c7\"},\"headline\":\"Configure multiple View Resolvers in Spring\",\"datePublished\":\"2016-03-02T08:00:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html\"},\"wordCount\":460,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Spring\",\"Spring MVC\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html\",\"name\":\"Configure multiple View Resolvers in Spring - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2016-03-02T08:00:23+00:00\",\"description\":\"1. Introduction In Spring, the View Resolver is provided to resolve the view with the data available in the model, without tightly binding to a\u00a0View\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/03\\\/configure-multiple-view-resolvers-spring.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Configure multiple View Resolvers in Spring\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/8084cf3db3cc9b2c21fc2c04307d47c7\",\"name\":\"Abhimanyu Prasad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8197b6658b8d42a7c85117f4aabe67206651698dbc306809655610f6af906610?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8197b6658b8d42a7c85117f4aabe67206651698dbc306809655610f6af906610?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8197b6658b8d42a7c85117f4aabe67206651698dbc306809655610f6af906610?s=96&d=mm&r=g\",\"caption\":\"Abhimanyu Prasad\"},\"description\":\"Abhimanyu is a passionate tech blogger and senior programmer, who has an extensive end-to-end development experience with wide range of technologies. He is the founder and administrator at jCombat.\",\"sameAs\":[\"http:\\\/\\\/www.jcombat.com\",\"https:\\\/\\\/www.facebook.com\\\/abhi435\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/abhimanyu-prasad\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Configure multiple View Resolvers in Spring - Java Code Geeks","description":"1. Introduction In Spring, the View Resolver is provided to resolve the view with the data available in the model, without tightly binding to a\u00a0View","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html","og_locale":"en_US","og_type":"article","og_title":"Configure multiple View Resolvers in Spring - Java Code Geeks","og_description":"1. Introduction In Spring, the View Resolver is provided to resolve the view with the data available in the model, without tightly binding to a\u00a0View","og_url":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/abhi435","article_published_time":"2016-03-02T08:00:23+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Abhimanyu Prasad","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Abhimanyu Prasad","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html"},"author":{"name":"Abhimanyu Prasad","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/8084cf3db3cc9b2c21fc2c04307d47c7"},"headline":"Configure multiple View Resolvers in Spring","datePublished":"2016-03-02T08:00:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html"},"wordCount":460,"commentCount":1,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Spring","Spring MVC"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html","url":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html","name":"Configure multiple View Resolvers in Spring - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2016-03-02T08:00:23+00:00","description":"1. Introduction In Spring, the View Resolver is provided to resolve the view with the data available in the model, without tightly binding to a\u00a0View","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2016\/03\/configure-multiple-view-resolvers-spring.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Configure multiple View Resolvers in Spring"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/8084cf3db3cc9b2c21fc2c04307d47c7","name":"Abhimanyu Prasad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8197b6658b8d42a7c85117f4aabe67206651698dbc306809655610f6af906610?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8197b6658b8d42a7c85117f4aabe67206651698dbc306809655610f6af906610?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8197b6658b8d42a7c85117f4aabe67206651698dbc306809655610f6af906610?s=96&d=mm&r=g","caption":"Abhimanyu Prasad"},"description":"Abhimanyu is a passionate tech blogger and senior programmer, who has an extensive end-to-end development experience with wide range of technologies. He is the founder and administrator at jCombat.","sameAs":["http:\/\/www.jcombat.com","https:\/\/www.facebook.com\/abhi435"],"url":"https:\/\/www.javacodegeeks.com\/author\/abhimanyu-prasad"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/53297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/958"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=53297"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/53297\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=53297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=53297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=53297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}