Configuring ViewResolver

To configure ViewResolver, we need to specify a bean for the class InternalResourceViewResolver in the spring-mvc-context.xml file, after <mvc:annotation-driven />. Let's do that:

<beans>
<!-- Schema definitions are skipped. -->
<context:component-scan base- package="com.packt.springhighperformance.ch4.controller" />
<mvc:annotation-driven />

<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolv er">
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>

After configuring ViewResolver, we will create a Controller to test the configuration. But, before moving on to that, let's see the Java-based configuration.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset