O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required