- Spring MVC Beginner’s Guide
- Amuthan G
- 161字
- 2021-07-16 11:25:44
View resolvers
We saw the purpose of the first two tags that are specified within the web application context configuration file:
<mvc:annotation-driven /> <context:component-scan base-package="com.packt.webstore" />
Based on these tags, Spring creates the necessary beans to handle a web request and also creates beans for all the @Controller
classes. However, to run a Spring MVC application successfully, Spring needs one more bean; this bean is called a view resolver.
A view resolver helps the dispatcher servlet identify the views that have to be rendered as the response for a specific web request. Spring MVC provides various view resolver implementations to identify views, and InternalResourceViewResolver
is one such implementation. The final tag in the web application context configuration is the bean definition for the InternalResourceViewResolver
class as follows:
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> </bean>
Through the preceding bean definition in the web application context configuration, we instruct Spring MVC to create a bean for the InternalResourceViewResolver
class (org.springframework.web.servlet.view.InternalResourceViewResolver
). We will learn more about the view resolver in Chapter 5, Working with View Resolver.
- Redis使用手冊
- Spark大數(shù)據(jù)分析實戰(zhàn)
- Effective Amazon Machine Learning
- Oracle RAC 11g實戰(zhàn)指南
- 工業(yè)大數(shù)據(jù)分析算法實戰(zhàn)
- Ceph源碼分析
- 中國數(shù)字流域
- 數(shù)據(jù)庫技術實用教程
- “互聯(lián)網(wǎng)+”時代立體化計算機組
- 基于OPAC日志的高校圖書館用戶信息需求與檢索行為研究
- Hadoop集群與安全
- 二進制分析實戰(zhàn)
- Spring Boot 2.0 Cookbook(Second Edition)
- 利用Python進行數(shù)據(jù)分析(原書第2版)
- 領域驅動設計精粹